gradle - Android Studio build too slow multidex application -
when add project multidex:true, , make application class extends multidexapplication, project build time passed 20 sec around 90 sec.how faster?
if me tried vic vu's solution still can't avoid enabling multidex can try (as long using device has android 5.0 , above).
note speed development build. production build still slow.
basically need introduce 2 product flavors 1 dev
, 1 prod
.
add multidexenabled true
android { productflavors { // define separate dev , prod product flavors. dev { // dev utilizes minsdkversion = 21 allow android gradle plugin // pre-dex each module , produce apk can tested on // android lollipop without time consuming dex merging processes. minsdkversion 21 } prod { // actual minsdkversion application. minsdkversion 14 } } ... buildtypes { release { runproguard true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } defaultconfig { applicationid "com.something.something" targetsdkversion 23 versioncode 1 versionname "1.0.0" multidexenabled true } } dependencies { compile 'com.android.support:multidex:1.0.1' }
and have class extends application
had override attachbasecontext()
@override protected void attachbasecontext(context base) { super.attachbasecontext(base); multidex.install(this); }
if not extending application
use multidexapplication
in androidmanifest.xml
application
tag.
ensure in android studio build variants
pointing devdebug
.
read complete instructions here https://developer.android.com/studio/build/multidex.html#dev-build
Comments
Post a Comment