I hit the dex magic limit because my application uses a lot of cans (api disk, greendao, text in pdf, support ..).
My current solution was that I literally created a second apk for google drive only, from which I called from the main apk. But now I found out that android finally supports this with this library. My problem is that I donβt know how to implement it (preferably without gradle). I canβt find good textbooks for him.
Okey I'm going crazy trying to realize this. I found this: http://blog.osom.info/2014/10/multi-dex-to-rescue-from-infamous-65536.html
And I added:
android:name="android.support.multidex.MultiDexApplication"
To manifest file and
protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }
In my mainactivity.java
Also installed is the gradle plugin for eclipse, exported gradle to get the build.gradle file, which I changed to:
apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':android-support-v7-appcompat') compile project(':Sync') compile project(':gdrive:google-play-services_lib') } android { compileSdkVersion 14 buildToolsVersion "21.1.1" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src-gen','src'] resources.srcDirs = ['src-gen','src'] aidl.srcDirs = ['src-gen','src'] renderscript.srcDirs = ['src-gen','src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } dexOptions { preDexLibraries = false } } afterEvaluate { tasks.matching { it.name.startsWith('dex') }.each { dx -> if (dx.additionalParameters == null) { dx.additionalParameters = ['--multi-dex'] } else { dx.additionalParameters += '--multi-dex' } } }
But the error remains the same: (
android android-gradle android-library dex
Tadej Vengust Nov 14 '14 at 7:47 2014-11-14 07:47
source share