更新到API 23后,NoClassDefFoundError:FingerprintManagerCompatApi23

时间:2015-10-11 04:49:14

标签: android android-gradle

我通过gradle更新到API 23以及依赖项,但是当我尝试运行我的应用程序时,我得到一个NoClassDefFoundError:

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,这是因为依赖关系,但我没有使用动态版本号。

1 个答案:

答案 0 :(得分:-1)

我的依赖关系更清晰

compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile files('libs/activeandroid-3.0.jar')

完成!以下是我为解决这个问题所做的工作。 1.将所有AppCompatActivity更改为Activity。

2.

compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:appcompat-v7:21.0.+'

将v7从23.1.0更改为21.0。+

3。将项目编译器版本从6.0(API23)更改为5.0(API21)

我的应用程序再次使用ActivieAndroid运行