0
我的應用程序運行良好,直到最近。然後,我將compileSdk和buildTools更新爲25.從那時起,我的應用程序在開啓時立即崩潰。設置minSdkVersion爲18解決了這個問題,但是當我把它重新設置爲21時,這就是事情發生了。 附加堆棧跟蹤和我的gradle這個文件的部分應用程序不啓動與minSdk 21
01-25 19:07:59.848 18879-18879/com.vimi.vimichat E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.vimi.vimichat, PID: 18879
java.lang.RuntimeException: Unable to instantiate application com.vimi.vimichat.Common: java.lang.ClassNotFoundException: Didn't find class "com.vimi.vimichat.Common" on path: DexPathList[[zip file "/data/app/com.vimi.vimichat-1/base.apk"],nativeLibraryDirectories=[/data/app/com.vimi.vimichat-1/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:586)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5041)
at android.app.ActivityThread.access$1500(ActivityThread.java:187)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1643)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5844)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1109)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:875)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.vimi.vimichat.Common" on path: DexPathList[[zip file "/data/app/com.vimi.vimichat-1/base.apk"],nativeLibraryDirectories=[/data/app/com.vimi.vimichat-1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:988)
at android.app.LoadedApk.makeApplication(LoadedApk.java:581)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5041)
at android.app.ActivityThread.access$1500(ActivityThread.java:187)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1643)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5844)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1109)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:875)
Suppressed: java.lang.ClassNotFoundException: com.vimi.vimichat.Common
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
附上我的項目gradle這個文件的部分
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
}
useLibrary 'org.apache.http.legacy'
}
我看到這些堆棧跟蹤誤差修改多次在這裏,但什麼問題沒有明確的答案。
我試過清理和重建,清理Android Studio緩存,更新gradle版本和插件。沒有什麼似乎爲我工作。
編輯1
這似乎是問題的一個或多個支持Android的庫
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
依靠他們都恢復到24.1.0似乎解決這個問題。但是,我正在使用它們的更高版本中的一些功能,所以這沒有幫助。
您是否正在使用任何本機庫?我重新編譯compileSdkVersion 24來解決大量的隨機錯誤。 – Ewald
你在運行什麼設備?哪個API版本? –
多個設備和API級別。模擬器,魅族m3s,SG注5,Android 5.1和6 – amitfr