gpt4 book ai didi

android - NoClassDefFoundError - AppCompatDelegateImplV14

转载 作者:行者123 更新时间:2023-11-29 17:24:04 25 4
gpt4 key购买 nike

我正在尝试通过替换所有要从 AppCompatActivity 扩展的 Activity 来更新项目。但是我的应用程序不会总是以相同的错误开始:

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

  • 应用兼容性 + 设计 (23.1.1)
  • 播放服务 (8.4.0)

我尝试了什么:

  1. 启用 multidex。
  2. 运行 gradlew -q :projectName:dependenciev - 否嵌套/我只在顶层排除了“support-v4”)。
  3. 清理/重建项目。

堆栈跟踪:

java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:135)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:117)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:456)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at [PACKAGE NAME].StartUpActivity.onCreate(StartUpActivity.java:18)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

构建.gradle :

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.3.2'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'


defaultConfig {
applicationId "[PACKAGENAME]"
minSdkVersion 9
targetSdkVersion 23
multiDexEnabled true

}

signingConfigs {
release {
// --------------- release keystore info
}
}

buildTypes {

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

release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}

packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE'
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['.apt_generated', 'src']
resources.srcDirs = ['.apt_generated', 'src']
aidl.srcDirs = ['.apt_generated', 'src']
renderscript.srcDirs = ['.apt_generated', 'src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName '[PACKAGENAME]'
}
}
dexOptions {
preDexLibraries = false
}
}
configurations {
all*.exclude group: 'com.android.support' , module: 'support-v4'
}

dependencies {
// --------- Projects
compile project(':facebook')
compile project(':zxing-2.3.0:android')
// compile fileTree(dir: 'libs', include: '*.jar')

// ------------ Compile local jars
compile files('libs/crittercism_v3_0_3_sdkonly.jar')
compile files('libs/ormlite-android-4.45.jar')
compile files('libs/ormlite-core-4.45.jar')
compile files('libs/viewpagerindicator.jar')

compile 'com.android.support:multidex:1.0.1'

compile(
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.2.3'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.2.3'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.2.3']
)


compile 'com.android.support:appcompat-v7:23.1.1'
compile ('com.android.support:design:23.1.1')

compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'

apt("org.androidannotations:androidannotations:$AAVersion")
compile ("org.androidannotations:androidannotations-api:$AAVersion")

}

Gradlew 依赖树:

_releaseCompile - ## Internal use, do not manually configure ##
+--- com.android.support:multidex:1.0.1
+--- project :facebook
+--- project :zxing-2.3.0:android
+--- com.fasterxml.jackson.core:jackson-core:2.2.3
+--- com.fasterxml.jackson.core:jackson-annotations:2.2.3
+--- com.fasterxml.jackson.core:jackson-databind:2.2.3
| +--- com.fasterxml.jackson.core:jackson-annotations:2.2.3
| \--- com.fasterxml.jackson.core:jackson-core:2.2.3
+--- com.android.support:appcompat-v7:23.1.1
+--- com.android.support:design:23.1.1
| +--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:recyclerview-v7:23.1.1
| \--- com.android.support:support-annotations:23.1.1
+--- com.google.android.gms:play-services-analytics:8.4.0
| \--- com.google.android.gms:play-services-basement:8.4.0
+--- com.google.android.gms:play-services-gcm:8.4.0
| +--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| \--- com.google.android.gms:play-services-measurement:8.4.0
| \--- com.google.android.gms:play-services-basement:8.4.0
+--- com.google.android.gms:play-services-location:8.4.0
| +--- com.google.android.gms:play-services-base:8.4.0 (*)
| \--- com.google.android.gms:play-services-maps:8.4.0
| \--- com.google.android.gms:play-services-base:8.4.0 (*)
\--- org.androidannotations:androidannotations-api:3.3.2

解决方案/对我/:我在子项目中有一个 support-v4 jar,无论如何我都无法排除它。所以我不得不修改子项目以排除 jar。

最佳答案

i have only exclude 'support-v4' at top level

你得到了

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

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

Build.gradle 中移除 Support-v4

compile project(':android-support-v4')

关于android - NoClassDefFoundError - AppCompatDelegateImplV14,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35308601/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com