gpt4 book ai didi

android - 多个dex文件用Gradle定义Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:11:42 26 4
gpt4 key购买 nike

当我运行 ./gradlew assembleDebug 时,我得到:

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/grub/Main/android-sdk-linux/build-tools/19.1.0/dx --dex --num-threads=4 --output

合并类和 jar 列表:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

它与this 非常相似问题和问题应该在多个 support-v4 库中。我清理了 build.gradle :

repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}

apply plugin: 'android'

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 8
versionName "2.1.17"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.+'
compile ('com.google.android.gms:play-services:5+'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile(project(':libraries:com.typefacedwidgets')) {
exclude group: 'com.android.support', module: 'support-v4'
}
compile(project(':libraries:com.truepagerindicator')) {
exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.sothree.slidinguppanel:library:+'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.github.chrisbanes.pulltorefresh:sample:2.1.1+'){
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.thoughtworks.xstream:xstream:1.4.7'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.google.code.gson:gson:2.3'
compile 'de.greenrobot:eventbus:2.2.1'
}
}

为了检查依赖关系,我做了 ./gradlew -q -dependencies 显示:

+--- com.android.support:support-v4:20.+ -> 20.0.0
| \--- com.android.support:support-annotations:20.0.0
+--- com.google.android.gms:play-services:5+ -> 5.2.08
+--- project :libraries:com.typefacedwidgets
+--- project :libraries:com.truepagerindicator
+--- com.sothree.slidinguppanel:library:+ -> 2.0.1
| \--- com.nineoldandroids:library:+ -> 2.4.0
+--- com.github.chrisbanes.pulltorefresh:sample:2.1.1+ -> 2.1.1
| +--- com.github.chrisbanes.pulltorefresh:library:2.1.1
| +--- com.github.chrisbanes.pulltorefresh:extra-listfragment:2.1.1
| | \--- com.github.chrisbanes.pulltorefresh:library:2.1.1
| \--- com.github.chrisbanes.pulltorefresh:extra-viewpager:2.1.1
| \--- com.github.chrisbanes.pulltorefresh:library:2.1.1
+--- com.thoughtworks.xstream:xstream:1.4.7
| +--- xmlpull:xmlpull:1.1.3.1
| \--- xpp3:xpp3_min:1.1.4c
+--- com.squareup.retrofit:retrofit:1.6.1
| \--- com.google.code.gson:gson:2.2.4 -> 2.3
+--- com.squareup.okhttp:okhttp-urlconnection:2.0.0
| \--- com.squareup.okhttp:okhttp:2.0.0
| \--- com.squareup.okio:okio:1.0.0
+--- com.squareup.okhttp:okhttp:2.0.0 (*)
+--- com.google.code.gson:gson:2.3
\--- de.greenrobot:eventbus:2.2.1

看起来应该没问题,但问题仍然存在。

更新:

问题出在 apkLib 依赖和来自 Gradle 的混淆消息中。它像在this中一样被解决了回答将 Android-PullToRefresh 放入 Gradle 中单独的 android 库项目中。

最佳答案

当我导入一些需要 Google Play 服务的库时出现这个错误,

我刚从:

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

到:

compile ('com.google.android.gms:play-services:6.5.87') {
exclude module: 'support-v4'
}

现在它构建正常

关于android - 多个dex文件用Gradle定义Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25384166/

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