Getting exception : java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
Getting exception : java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
我最近更新了 Android Studio 和 android 设计库,此后我遇到了异常 java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
。
不确定是什么问题,我几乎尝试了所有方法,它在 lollipop 5.1 设备 (nexus 4) 中工作,但在 Android 4.4 设备和 4.02 设备中不起作用。它在所有版本的更新之前都在工作。
我尝试了 Whosebug 中提到的所有解决方案,但没有任何效果。
也尝试删除 build.gradle 中的 compile 'com.android.support:support-v4:22.2.0'
行,但它也不起作用。
也尝试过清理和重建,但还是没有用。
07-13 18:51:26.702: E/AndroidRuntime(1105): FATAL EXCEPTION: main
07-13 18:51:26.702: E/AndroidRuntime(1105): Process: com.Whosebug.ranjith.androidprojdel, PID: 1105
07-13 18:51:26.702: E/AndroidRuntime(1105): java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:93)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:429)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
07-13 18:51:26.702: E/AndroidRuntime(1105): at com.Whosebug.ranjith.androidprojdel.AppCompActivity.onCreate(AppCompActivity.java:34)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.Activity.performCreate(Activity.java:5231)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.access0(ActivityThread.java:135)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.os.Handler.dispatchMessage(Handler.java:102)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.os.Looper.loop(Looper.java:136)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.main(ActivityThread.java:5001)
07-13 18:51:26.702: E/AndroidRuntime(1105): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 18:51:26.702: E/AndroidRuntime(1105): at java.lang.reflect.Method.invoke(Method.java:515)
07-13 18:51:26.702: E/AndroidRuntime(1105): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-13 18:51:26.702: E/AndroidRuntime(1105): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-13 18:51:26.702: E/AndroidRuntime(1105): at dalvik.system.NativeStart.main(Native Method)
build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.Whosebug.ranjith.androidprojdel"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:design:22.2.0'
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
compile 'joda-time:joda-time:2.8'
compile 'com.github.ranjithnair02:simplecontactmview:0.6-SNAPSHOT'
compile 'com.github.alamkanak:android-week-view:1.2.3'
compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:1.6.1@aar') {
transitive = true;
}
}
我的style.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#673AB7</item>
<item name="colorPrimaryDark">#512DA8</item>
<item name="colorAccent">#4400b0</item>
</style>
<resources>
我解决了这个问题,如果有人遇到这个问题,请尝试这些选项(第 3 点解决了我的问题):
在build.gradle的defaultConfig中添加multiDexEnabled true
。
defaultConfig {
applicationId "com.something.ranjith.androidprojdel"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
如果您的 activity 扩展了 `AppcompatActivity'
,请删除 android 支持库
compile 'com.android.support:support-v4:22.+'
//去掉这个
如果您的应用程序中有 PlayServices
,请删除 PlayServices
并添加单独的 API。
例如:- 如果您使用 PlayServices
作为广告,则只需添加 compile com.google.android.gms:play-services-ads:7.5.0
而不是 compile com.google.android.gms:play-services:7.5.0
PlayServices 的各个 API 列表:
- Google+
com.google.android.gms:play-services-plus:7.5.0
- Google 账号登录
com.google.android.gms:play-services-identity:7.5.0
- Google 操作,基本客户端库
com.google.android.gms:play-services-base:7.5.0
- Google 应用索引
com.google.android.gms:play-services-appindexing:7.5.0
- Google 应用邀请
com.google.android.gms:play-services-appinvite:7.5.0
- Google 分析
com.google.android.gms:play-services-analytics:7.5.0
- Google 投
com.google.android.gms:play-services-cast:7.5.0
- Google 云消息
com.google.android.gms:play-services-gcm:7.5.0
- Google 驱动器
com.google.android.gms:play-services-drive:7.5.0
- Google适合
com.google.android.gms:play-services-fitness:7.5.0
- Google 位置,Activity 识别和地点
com.google.android.gms:play-services-location:7.5.0
- Google 地图
com.google.android.gms:play-services-maps:7.5.0
- 移动广告
com.google.android.gms:play-services-ads:7.5.0
- Google附近
com.google.android.gms:play-services-nearby:7.5.0
- Google 全景查看器 `com.google.android.gms:play-services-panorama:7.5.0
- Google 玩游戏服务
com.google.android.gms:play-services-games:7.5.0
- 安全网
com.google.android.gms:play-services-safetynet:7.5.0
- Google 钱包
com.google.android.gms:play-services-wallet:7.5.0
- Android穿
com.google.android.gms:play-services-wearable:7.5.0
我最近更新了 Android Studio 和 android 设计库,此后我遇到了异常 java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
。
不确定是什么问题,我几乎尝试了所有方法,它在 lollipop 5.1 设备 (nexus 4) 中工作,但在 Android 4.4 设备和 4.02 设备中不起作用。它在所有版本的更新之前都在工作。
我尝试了 Whosebug 中提到的所有解决方案,但没有任何效果。
也尝试删除 build.gradle 中的 compile 'com.android.support:support-v4:22.2.0'
行,但它也不起作用。
也尝试过清理和重建,但还是没有用。
07-13 18:51:26.702: E/AndroidRuntime(1105): FATAL EXCEPTION: main
07-13 18:51:26.702: E/AndroidRuntime(1105): Process: com.Whosebug.ranjith.androidprojdel, PID: 1105
07-13 18:51:26.702: E/AndroidRuntime(1105): java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:93)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:429)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
07-13 18:51:26.702: E/AndroidRuntime(1105): at com.Whosebug.ranjith.androidprojdel.AppCompActivity.onCreate(AppCompActivity.java:34)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.Activity.performCreate(Activity.java:5231)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.access0(ActivityThread.java:135)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.os.Handler.dispatchMessage(Handler.java:102)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.os.Looper.loop(Looper.java:136)
07-13 18:51:26.702: E/AndroidRuntime(1105): at android.app.ActivityThread.main(ActivityThread.java:5001)
07-13 18:51:26.702: E/AndroidRuntime(1105): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 18:51:26.702: E/AndroidRuntime(1105): at java.lang.reflect.Method.invoke(Method.java:515)
07-13 18:51:26.702: E/AndroidRuntime(1105): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-13 18:51:26.702: E/AndroidRuntime(1105): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-13 18:51:26.702: E/AndroidRuntime(1105): at dalvik.system.NativeStart.main(Native Method)
build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.Whosebug.ranjith.androidprojdel"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:design:22.2.0'
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
compile 'joda-time:joda-time:2.8'
compile 'com.github.ranjithnair02:simplecontactmview:0.6-SNAPSHOT'
compile 'com.github.alamkanak:android-week-view:1.2.3'
compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:1.6.1@aar') {
transitive = true;
}
}
我的style.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#673AB7</item>
<item name="colorPrimaryDark">#512DA8</item>
<item name="colorAccent">#4400b0</item>
</style>
<resources>
我解决了这个问题,如果有人遇到这个问题,请尝试这些选项(第 3 点解决了我的问题):
在build.gradle的defaultConfig中添加
multiDexEnabled true
。defaultConfig { applicationId "com.something.ranjith.androidprojdel" minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" multiDexEnabled true }
如果您的 activity 扩展了 `AppcompatActivity'
,请删除 android 支持库compile 'com.android.support:support-v4:22.+'
//去掉这个如果您的应用程序中有
PlayServices
,请删除PlayServices
并添加单独的 API。 例如:- 如果您使用PlayServices
作为广告,则只需添加compile com.google.android.gms:play-services-ads:7.5.0
而不是compile com.google.android.gms:play-services:7.5.0
PlayServices 的各个 API 列表:
- Google+
com.google.android.gms:play-services-plus:7.5.0
- Google 账号登录
com.google.android.gms:play-services-identity:7.5.0
- Google 操作,基本客户端库
com.google.android.gms:play-services-base:7.5.0
- Google 应用索引
com.google.android.gms:play-services-appindexing:7.5.0
- Google 应用邀请
com.google.android.gms:play-services-appinvite:7.5.0
- Google 分析
com.google.android.gms:play-services-analytics:7.5.0
- Google 投
com.google.android.gms:play-services-cast:7.5.0
- Google 云消息
com.google.android.gms:play-services-gcm:7.5.0
- Google 驱动器
com.google.android.gms:play-services-drive:7.5.0
- Google适合
com.google.android.gms:play-services-fitness:7.5.0
- Google 位置,Activity 识别和地点
com.google.android.gms:play-services-location:7.5.0
- Google 地图
com.google.android.gms:play-services-maps:7.5.0
- 移动广告
com.google.android.gms:play-services-ads:7.5.0
- Google附近
com.google.android.gms:play-services-nearby:7.5.0
- Google 全景查看器 `com.google.android.gms:play-services-panorama:7.5.0
- Google 玩游戏服务
com.google.android.gms:play-services-games:7.5.0
- 安全网
com.google.android.gms:play-services-safetynet:7.5.0
- Google 钱包
com.google.android.gms:play-services-wallet:7.5.0
- Android穿
com.google.android.gms:play-services-wearable:7.5.0