我尝试将我的应用程序支持库从26.0.2
更新为27.1.0
,但面临以下错误。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'APPLICATION_ID'
minSdkVersion 17
targetSdkVersion 27
versionCode 240
versionName "2.4.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
useLibrary 'org.apache.http.legacy'
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:support-vector-drawable:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
androidTestImplementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.google.android.gms:play-services-location:11.0.4'
implementation 'com.google.android.gms:play-services-analytics:11.0.4'
implementation 'com.google.android.gms:play-services-gcm:11.0.4'
api 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.android.support:support-media-compat:27.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
}
apply plugin: 'com.google.gms.google-services'
05-18 02:56:15.744 13645-13645/net.kord_music.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.kord_music.android, PID: 13645
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/ListViewCompat;
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at com.activeandroid.ModelInfo.scanForModelClasses(ModelInfo.java:187)
at com.activeandroid.ModelInfo.scanForModel(ModelInfo.java:152)
at com.activeandroid.ModelInfo.<init>(ModelInfo.java:63)
at com.activeandroid.Cache.initialize(Cache.java:66)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
at com.activeandroid.app.Application.onCreate(Application.java:25)
at system.G.onCreate(G.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1028)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5658)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.ListViewCompat" on path: DexPathList[[zip file "/data/app/net.kord_music.android-1/base.apk"],nativeLibraryDirectories=[/data/app/net.kord_music.android-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at com.activeandroid.ModelInfo.scanForModelClasses(ModelInfo.java:187)
at com.activeandroid.ModelInfo.scanForModel(ModelInfo.java:152)
at com.activeandroid.ModelInfo.<init>(ModelInfo.java:63)
at com.activeandroid.Cache.initialize(Cache.java:66)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
at com.activeandroid.app.Application.onCreate(Application.java:25)
at system.G.onCreate(G.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1028)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5658)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
答案 0 :(得分:1)
我遇到了同样的问题,解决方法是 将每个XML标签“ android.support.v7.widget.ListViewCompat”更改为“ android.widget.ListView”
答案 1 :(得分:0)
Problem is here
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.ListViewCompat" on path: DexPathList[[zip file "/data/app/net.kord_music.android-1/base.apk"],nativeLibraryDirectories=[/data/app/net.kord_music.android-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
Update your java files to
import android.support.v7.widget.ListViewCompat;
and your layout files accordingly
<android.support.v7.widget.ListViewCompat
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />