how are you ?. i've searched this question carefully but there seems no complete answer as to why and how to solve this issue.
okay, at first i am running Android Studio 1.5.1 with completely out dated gradle and sdk version but at that time i felt enough to use those old versions but now i updated all of those to android 2.3.1 latest SDK and latest Gradle.
as you may already know if i run directly from Android Studio it works fine, but when i copy my app_debug.apk file it suddenly showing the error
Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.asd.asd.asd1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
i've applied many solution to this particular error, one which being successful was changin my gradel version in modul:app gradle from
classpath 'com.android.tools.build:gradle:2.3.1'
to
classpath 'com.android.tools.build:gradle:2.2.3'
but then i tried all other app that i've made before and applying the same method. strangely, it didn't work.
and i think there is something that i am missing here but i dont know what, i dont want to enable multiDexEnabled because i dont think that's a good way to solve this problem.
thanks.
what you have to do is enable Multidex in gradle
defaultConfig{
multiDexEnabled true
}
else you need to minimize the use of heavy dependencies. if you insist to use those dependencies, you need to exclude module android support module in those dependencies..
for example, i already have appcompat-v7 in my list. so exclude module appcompat-v7 from third party library.
compile ('uk.co.chrisjenx:calligraphy:2.2.0'){
exclude group: 'com.android.support', module: 'appcompat-v7'
transitive = false
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.