multidex - Android - UNEXPECTED TOP-LEVEL EXCEPTION: -
i facing error while adding payumoney in app. here error -
unexpected top-level exception:
`com.android.dex.dexindexoverflowexception: method id not in [0, 0xffff]: 65536 @ com.android.dx.merge.dexmerger$6.updateindex(dexmerger.java:484) @ com.android.dx.merge.dexmerger$idmerger.mergesorted(dexmerger.java:261) @ com.android.dx.merge.dexmerger.mergemethodids(dexmerger.java:473) @ com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:161) @ com.android.dx.merge.dexmerger.merge(dexmerger.java:188) atcom.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java0) @ com.android.dx.command.dexer.main.runmonodex(main.java:334) @ com.android.dx.command.dexer.main.run(main.java:277) @ com.android.dx.command.dexer.main.main(main.java:245) @ com.android.dx.command.main.main(main.java:106)`
here build.gradle(app) file code
apply plugin: 'com.android.application'
android { compilesdkversion 23 buildtoolsversion "23.0.3"
defaultconfig { applicationid "com.xxxxxxxxxxx" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } }} repositories { maven { url "https://jitpack.io" }} dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.2.1' compile 'com.android.support:design:23.2.1' compile 'com.github.philjay:mpandroidchart:v2.2.3' compile 'com.mcxiaoke.volley:library:1.0.19' compile 'com.squareup.picasso:picasso:2.3.2' compile project(':viewpagerlib') compile project(':payu-release') compile project(':sdkui') compile 'com.google.android.gms:play-services:8.4.0'}
here build.gradle(project)
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' classpath 'com.github.dcendents:android-maven-plugin:1.2' // note: not place application dependencies here; belong // in individual module build.gradle files }} allprojects { repositories { jcenter() }} task clean(type: delete) { delete rootproject.builddir}
if use multidex true in build.gradle, error solved app crash on first screen.
add following dependency:
compile 'com.android.support:multidex:1.0.1'
also, minifyenabled true;
and add following in application class:
@override protected void attachbasecontext(context base) { super.attachbasecontext(base); multidex.install(this); }
Comments
Post a Comment