1
我通過gradle這個更新到API 23以及依賴關係,但是當我試圖運行我的應用程序我得到一個NoClassDefFoundError的經過:NoClassDefFoundError的:FingerprintManagerCompatApi23更新到API 23
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: FATAL EXCEPTION: main
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: Process: com.aufmschoolbliz.app, PID: 11323
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: java.lang.NoClassDefFoundError: android.support.v4.hardware.fingerprint.FingerprintManagerCompatApi23$1
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.Class.classForName(Native Method)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.Class.forName(Class.java:309)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.ReflectionUtils.getModelClasses(ReflectionUtils.java:83)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.DatabaseHelper.onCreate(DatabaseHelper.java:46)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.Registry.openDatabase(Registry.java:149)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.Registry.initialize(Registry.java:107)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:8)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.app.Application.onCreate(Application.java:9)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.aufmschoolbliz.app.SchoolBliz.onCreate(SchoolBliz.java:42)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:151)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5254)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
級文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 4
versionName "2.1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':numberPickerSupport')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
}
根據ianhanniballake,https://stackoverflow.com/a/32484445/2450000,這是因爲依賴關係,但我沒有使用動態版本號。
我使用API 24,我該如何解決這個問題? – user987760
活動Android造成的這個問題是一個死了的項目。 https://github.com/pardom/ActiveAndroid/issues/431 –
建議使用DBFlow或Ollie(由Active Android作者撰寫)。 –