NoClassDefFoundError:android.support.v7.app.ActionBarActivity

时间:2015-07-27 12:27:21

标签: android android-gradle build.gradle

过去两天我一直收到java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegate错误,我会讨厌android,它会继续这样。我真的很无望。我正在添加goseamless api,我刚刚收到此错误     这行代码上的superOnCreate方法

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);

在尝试设置contentView

时会出现以下错误

。但是,如果我不添加它,应用程序构建没有问题。

这是堆栈跟踪

07-27 15:10:18.130      814-814/com.fourspan.ekmobi I/System.out﹕ debugger has settled (1365)
07-27 15:10:18.180      814-814/com.fourspan.ekmobi V/HwPolicyFactory﹕ : success to get AllImpl object and return....
07-27 15:10:18.210      814-814/com.fourspan.ekmobi V/HwWidgetFactory﹕ : successes to get AllImpl object and return....
07-27 15:10:19.450      814-814/com.fourspan.ekmobi D/dalvikvm﹕ threadid=1: still suspended after undo (sc=1 dc=1)
07-27 15:10:31.590      814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateJBMR2', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.590      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1269 (Landroid/support/v7/app/ActionBarActivityDelegateJBMR2;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.590      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0006
07-27 15:10:31.590      814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateJB', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.590      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1268 (Landroid/support/v7/app/ActionBarActivityDelegateJB;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.590      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0012
07-27 15:10:31.600      814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateICS', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.600      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1267 (Landroid/support/v7/app/ActionBarActivityDelegateICS;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x001e
07-27 15:10:31.600      814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateHC', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.600      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1266 (Landroid/support/v7/app/ActionBarActivityDelegateHC;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x002a
07-27 15:10:31.600      814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateBase', referenced from method android.support.v7.app.ActionBarActivityDelegate.createDelegate
07-27 15:10:31.600      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1265 (Landroid/support/v7/app/ActionBarActivityDelegateBase;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0030
07-27 15:10:31.600      814-814/com.fourspan.ekmobi E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegate$ActionBarDrawableToggleImpl', referenced from method android.support.v7.app.ActionBarActivityDelegate.getDrawerToggleDelegate
07-27 15:10:31.600      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve new-instance 1263 (Landroid/support/v7/app/ActionBarActivityDelegate$ActionBarDrawableToggleImpl;) in Landroid/support/v7/app/ActionBarActivityDelegate;
07-27 15:10:31.600      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
07-27 15:10:31.610      814-814/com.fourspan.ekmobi W/dalvikvm﹕ VFY: unable to resolve static field 2683 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
07-27 15:10:31.610      814-814/com.fourspan.ekmobi D/dalvikvm﹕ VFY: replacing opcode 0x62 at 0x0004
07-27 15:10:31.610      814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2523 at 0x08 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.610      814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2522 at 0x14 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.610      814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2521 at 0x20 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.610      814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2520 at 0x2c in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.620      814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x251f at 0x32 in Landroid/support/v7/app/ActionBarActivityDelegate;.createDelegate
07-27 15:10:31.620      814-814/com.fourspan.ekmobi D/dalvikvm﹕ DexOpt: unable to opt direct call 0x24fe at 0x03 in Landroid/support/v7/app/ActionBarActivityDelegate;.getDrawerToggleDelegate
07-27 15:10:31.620      814-814/com.fourspan.ekmobi D/AndroidRuntime﹕ Shutting down VM
07-27 15:10:31.620      814-814/com.fourspan.ekmobi W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41f58c50)
07-27 15:10:31.630      814-814/com.fourspan.ekmobi E/AndroidRuntime﹕ FATAL      EXCEPTION: main
Process: com.fourspan.ekmobi, PID: 814
java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegateJBMR2
        at android.support.v7.app.ActionBarActivityDelegate.createDelegate(ActionBarActivityDelegate.java:48)
        at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:96)
        at com.fourspan.ekmobi.SplashScreenActivity.onCreate(SplashScreenActivity.java:18)
        at android.app.Activity.performCreate(Activity.java:5286)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2233)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2319)
        at android.app.ActivityThread.access$1100(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1232)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5253)
        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:939)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
        at dalvik.system.NativeStart.main(Native Method)
07-27 15:12:46.750      814-814/com.fourspan.ekmobi I/Process﹕ Sending signal. PID: 814 SIG: 9

此处还有我的buildGraddle应用

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion 22.0.1

defaultConfig {

    minSdkVersion 16
    targetSdkVersion 21
    multiDexEnabled true
}

dexOptions {
    //incremental true
    javaMaxHeapSize "2048M"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

repositories {
maven {
    url "http://maven.seamlessapi.com:8081/nexus/content/repositories/releases/"
}
}

dependencies {
compile files('libs/picasso-2.5.2.jar')
compile project(':Libraries:CropImageLib')
compile project(':Libraries:facebook-android')
compile project(':Libraries:NineOldLibs')
compile project(':Libraries:SlidingMenu')
compile files('libs/JTransforms-3.0.jar')
compile files('libs/JLargeArrays-1.2.jar')
compile files('libs/gdata-core-1.0.jar')
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.goseamless:seamless:2.4.0'
}

如果您需要更多信息,请与我们联系 请帮助,问候。

2 个答案:

答案 0 :(得分:2)

Android版 getItemPosition() ,不推荐使用类ActionBarActivity。您应该使用AppCompatActivity

答案 1 :(得分:1)

由于您使用的是com.android.support:appcompat-v7:18.0,因此应将被删除的ActionBarActivity替换为AppCompatActivity