my app exceeding 64k methods iam supposed implement multidex , had problem "local path doesnt exist" fixed problem ,now gradle generated classes1.dex , classes2.dex , not working in lower lollipop..it working fine in lollipop since has native support .error says "<1st activity> not present in dex path"
after seeing tutorials said have change in 1.gradle 2.application class 3.manifest
i dont have knowledge application class ..kindly guide me thanks
note:this imported project eclipse .
kindly check build.gradle file
apply plugin: 'com.android.application' android { defaultconfig { compilesdkversion 23 buildtoolsversion '23.0.1' minsdkversion 15 //lower 14 doesn't support multidex targetsdkversion 23 } dexoptions { jumbomode = true predexlibraries = false javamaxheapsize "2048m" } afterevaluate { tasks.matching { it.name.startswith('dex') }.each { dx -> if (dx.additionalparameters == null) { dx.additionalparameters = ['--multi-dex'] } else { dx.additionalparameters += '--multi-dex' } } } sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] resources.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } // move tests tests/java, tests/res, etc... instrumenttest.setroot('tests') // move build types build-types/<type> // instance, build-types/debug/java, build-types/debug/androidmanifest.xml, ... // moves them out of them default location under src/<type>/... // conflict src/ being used main source set. // adding new build types or product flavors should accompanied // similar customization. debug.setroot('build-types/debug') release.setroot('build-types/release') } productflavors { } buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.android.support:multidex:1.0.1' }
you followed tutorial shows how add multi-dex support manually before android gradle plugin had support it. since v0.14.0, need add:
android { defaultconfig { ... multidexenabled true }
and can choose 1 of 3 options call multidex code. multidexapplication documentation:
minimal multidex capable application. use legacy multidex library there 3 possibilities:
- declare class application in androidmanifest.xml.
- have application extends class.
- have application override attachbasecontext starting withprotected void attachbasecontext(context base) { super.attachbasecontext(base); multidex.install(this); }
don't forget remove afterevaluate
block build script.
make sure you've read official documentation.
Comments
Post a Comment