Hunt
Hunt

Reputation: 8425

create excel sheet in android

I am trying to generate excel reports from my android app and for that i came across apache POI but when i import the jar files into the folder its showing me following error whoich i have found at may places over web.

for libraries like

poi-3.11-20141221.jar
poi-ooxml-3.11-20141221.jar
poi-ooxml-schemas-3.11-20141221.jar

trouble writing output: Too many method references: 76142; max is 65536.

then i went down to the little later version

trouble writing output: Too many method references: 66024; max is 65536.

poi-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
poi-ooxml-schemas-3.9-20121203.jar

i have seen may post related to it , but still didnt find any definate way to resolve the issue , would appreciate if anyone can suggest a roadmap

Upvotes: 1

Views: 801

Answers (1)

Xyaren
Xyaren

Reputation: 953

Your libraries are defining a lot of methods you may not use. Try enabling minify inside your gradle build file:

 android {
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
 }

This will stop compiling unused code. ProGuard is included inside the AndroidStudio gradle plugin.

In addition you can enable resource shrinking:

...
release {
    minifyEnabled true
    shrinkResources true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
...

Same for debug{...}

Update

Looks like a build tools problem: Changelog BuildTools v21.1 (October 2014):

"Added multidex file support for APKs and Jack suppport to address the 64K method reference limit."

Upvotes: 2

Related Questions