更新到appcompat 22.2.0后出现NoClassDefFoundError

时间:2015-07-16 12:32:37

标签: android android-appcompat

我在尝试启动第一个活动时遇到此问题。它在Android 5.0上运行良好,但低于我收到的问题。

7-16 08:23:22.499  16265-16265/com.diofeher.App E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.diofeher.App, PID: 16265
java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr
    at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:289)
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:246)
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
    at com.diofeher.App.LoginActivity.onCreate(LoginActivity.java:56)
    at android.app.Activity.performCreate(Activity.java:5231)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
    at android.app.ActivityThread.access$800(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)

这是我的gradle文件:( appcompat是第一个:()

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:design:22.2.0'
    compile 'com.android.support:recyclerview-v7:22.0.0'
    compile 'com.android.support:cardview-v7:22.0.0'
    compile 'com.android.support:multidex:1.0.0'
    compile project(':libs:android-support-v4-preferencefragment')
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'br.com.liveo:navigationdrawer-material:2.3.4'
    compile 'com.koushikdutta.ion:ion:2.0.0'
    compile 'com.rengwuxian.materialedittext:library:2.0.3'
    compile 'com.afollestad:material-dialogs:0.6.7.2'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.roomorama:caldroid:1.1.8'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.splunk.mint:mint:4.2'
    compile 'com.mobsandgeeks:android-saripaar:2.0-SNAPSHOT'
    compile('com.github.ganfra:material-spinner:1.1.0') {
        exclude group: 'com.nineoldandroids', module: 'library'
    }
    compile('com.github.florent37:materialviewpager:1.0.4@aar') {
        transitive = true
    }
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'me.grantland:autofittextview:0.2.0'
    compile 'com.jakewharton:butterknife:7.0.1'

    //    BILLING
    compile 'com.anjlab.android.iab.v3:library:1.0.+@aar'
}

试图重建但对我没有运气:(

1 个答案:

答案 0 :(得分:0)

Getting exception : java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14

使用此问题的答案来解决我的问题。

更改自:

compile 'com.google.android.gms:play-services:7.5.0'

为:

compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'