- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试在我的 Android 应用程序中使用 Amazon AWS SDK。该应用程序已使用 C2Call SDK。该应用程序正在运行,但只要我添加 AWS gradle 库,它就会开始给我多个 Dex 文件异常。我搜索了它并了解到它与多次定义的单个库有关,但是我不确定它是哪个,从日志中。我尝试删除不同的 gradle 编译选项,每当我添加一个 AWS 库时,它都会给出 Multiple Dex Exception。
这是我的应用程序的 gradle 文件 -
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.test.test"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
/*compile 'com.android.support:appcompat-v7:22.2.0'*/
compile(name: 'lib-c2callsdk', ext: 'aar')
compile 'com.amazonaws:aws-android-sdk-cognito:2.2.3'
compile 'com.amazonaws:aws-android-sdk-ses:2.2.3'
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.3'
}
我也尝试添加和删除 appcompact。
这是我收到的错误日志 -
Information:Gradle tasks [:app:assembleDebug]
Warning:Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareLibC2callsdkLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$4) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$5) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.LogFactory$6) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.amazonaws.services.s3.model.a.d) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/amazonaws/AmazonWebServiceClient;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 25.398 secs
Information:1 error
Information:2 warnings
Information:See complete output in console
如果我只选择一个 AWS 库,例如 cognito,它会给出相同的异常,而不会出现那些长警告。
知道我在这里做错了什么吗?我怎样才能找到确切的问题?
更新:
我尝试将以下内容放入应用程序的 gradle -
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
/*compile 'com.android.support:appcompat-v7:22.2.0'*/
compile(name: 'lib-c2callsdk', ext: 'aar'){
exclude group:'gson'
exclude group:'commons-logging'
}
compile ('com.amazonaws:aws-android-sdk-core:2.+'){
exclude group:'gson'
exclude group:'commons-logging'
}
/*compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ses:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'*/
/*compile 'com.google.code.gson:gson:2.3'*/
}
现在错误减少到这个 -
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareLibC2callsdkLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/amazonaws/AmazonWebServiceClient;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 2.804 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
最佳答案
错误提示 com.amazonaws.AmazonWebServiceClient
被定义了多次。您的项目中可能引用了多个 AWS Android SDK 副本,其中一个显然来自 Maven。请您仔细检查一下 libs 文件夹下是否有其他文件?我不熟悉c2call。不确定其中是否有与 AWS SDK 冲突的内容。一种检查方法是解压缩 jar 并搜索特定类。这是一个例子:
unzip -l *.jar | grep AmazonWebServiceClient
至于警告,请随意忽略它。 AWS Android SDK 依赖于使用 JDK 1.5 编译的 apache-commons-logging 1.1.1。 Android 不喜欢它,但可以接受它。
关于android - 多个dex文件定义Lcom/amazonaws/AmazonWebServiceClient;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31534073/
Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files defi
我试图在 avd 中运行我的应用程序,但是当我选择运行 gradle 时出现异常: Error:Error converting bytecode to dex: Cause: com.android
当我提取一个文件 aab 时出现这个错误: Invalid dex file indices, expecting file 'classes٢.dex' but found 'classes2.de
我有一个 ionic 项目。它已成功构建并在我的 android 手机中运行。突然有一天,当我运行命令“ionic cordova run android”时,我得到如下构建错误: Dex: Erro
这个问题在这里已经有了答案: Unable to execute dex: Multiple dex files define (31 个回答) 4年前关闭。 我更新了 android studio
从过去 3 天开始,我遇到了这个错误,并且已经尽了我所能。任何人都可以帮我纠正它。我正在使用 Android 3.0,我的 sdk 和 Google Play 服务已更新,并且我已将 multiDex
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.nnroh.debtmanager, PI
好的,现在我真的被困在这里了。我不知道该做什么,去哪里或任何事情! 我一直在尝试卸载、重新安装 SDK 和 Eclipse 版本,尝试用谷歌搜索出来,但是 nu-uh... 什么都没有!!! 我可以在
怎么了?为什么我有这个问题? Unable to execute dex: Multiple dex files define Lcom/nineoldandroids/animation/Anima
我尝试运行我的 android 应用程序,但出现此错误。 [2014-03-11 11:21:34 - Dex Loader] Unable to execute dex: Multiple dex
我希望指定包中的所有类都驻留在主 dex 文件中。 那里有使用通配符的选项吗? 最佳答案 很遗憾,不支持通配符。 但是,您可以使用 this script 生成 main-dex-list 文件。 .
我目前有一个来自霍尼韦尔的 DEX BLE-1 适配器,用于从自动售货机检索 dex 数据。我有一个 swift 3 iOS 应用程序,它使用 CoreBluetooth 进行扫描并与外围设备配对。该
我正在使用 IntelliJ IDEA 12.1.4,在我的项目中我使用了几个库/项目: ActionBarSherlock ViewPagerIndicator Volley ProgressShe
我在尝试运行我的项目时遇到了这个问题 - com.android.builder.dexing.DexArchiveBuilderException: Failed to process .gradl
我一直在四处寻找,有很多帖子与这个问题有关,但似乎没有确定的解决方案(例如 Error when building apk - "Multiple dex files define Lcom/goog
我正在对 Jan Berkel 的 SBT Android 插件进行一些黑客攻击,我在想是否有一种方法可以将多个 .dex 文件合并到一个 .dex 文件中包含所有这些。 例如,如果我有这个: cla
我在尝试运行我的应用程序时遇到了这些问题,但不知道如何解决... 谁能帮帮我 这是错误: [2014-04-18 18:47:35 - Dex Loader] Unable to execute de
这个问题在这里已经有了答案: Android support multidex library implementation (4 个回答) 4年前关闭。 生成签名的apk时,有这个错误,但构建项目是
我有一个 Android 应用程序,(理论上)它可以变成一个库并放入外部应用程序中。然后外部应用程序可以创建一个包含我的应用程序的选项卡。库应用程序的设置方式与 google-play-service
我正在开发一个 android 应用程序并且 gradle 构建工作正常但是现在当我构建我的 android 项目时,gradle 构建失败并显示以下错误 Error converting bytec
我是一名优秀的程序员,十分优秀!