- 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/
这个问题已经有答案了: Spark 1.5.1, Cassandra Connector 1.5.0-M2, Cassandra 2.1, Scala 2.10, NoSuchMethodError
我想实现来自 https://github.com/dm77/barcodescanner 的条码扫描器库.像这样运行项目后出现错误 java.lang.NoSuchFieldError: No st
尝试从我的 QA 环境访问 mongodb 时显示以下错误。 java.lang.NoSuchMethodError: com.mongodb.MongoClient. (Ljava/util/Lis
我创建了 android 应用程序并尝试将 admob 添加到它。但它不起作用。谁能帮我解决这个错误。 [2014-04-09 15:16:51 - Dex Loader] Unable to exe
在工作中,我们使用多种工具来捕获多种指标(主要是圈复杂度和 LCOM)。我们使用它们来获取警告标志并指导先发制人的重构工作。这对提高代码质量非常有益。 但是,该过程与构建过程无关。它是单独进行的。此外
我正在查看此处显示的 LCOM 指标, http://www.ndepend.com/Metrics.aspx 所以我们说了一些事情, 1) A class is utterly cohesive i
毕竟我已经为 NDK 设法“准备”了我的 eclipse(至少我是这么认为的),它不再在 c 代码中争论了,但是现在我在执行任何时候都得到“没有找到本地 Lcom 的实现” native 代码..它也
所以,我的应用已经发布了将近一年,但没有看到这个问题,现在它出现了。 即使是现在,我的手机上的调试版本也没有这个问题。我对从 Android Studio 打开的任何模拟器没有任何问题。然而,Goog
我是 Android Studio 的新手,每次尝试运行我的应用程序时,都会遇到异常 Error:Execution failed for task ':abc:dexDebug'. com.andr
我配置了 Google 登录和 AWS 身份池。我正在尝试设置 没有 AWS 登录 UI 的 google sigin .用谷歌成功登录后,我试图在android中访问AWSMobileClient
我在 Android 项目中使用 JNetPcap 库:即使我将 JNetPcap 设置为项目的库,我也无法使用此代码访问我的 native 应用程序。 有人可以帮助我吗?拜托了 我的代码如下: im
我正在使用 Spring MVC 构建 Web 应用程序。我创建了一个名为 User 的新 VO,并创建了一个 POST 方法来处理该 VO。 VO 有默认构造函数,但我得到了 java.lang.N
我一直在四处寻找,有很多帖子与这个问题有关,但似乎没有确定的解决方案(例如 Error when building apk - "Multiple dex files define Lcom/goog
我正在尝试模拟下课。 public class testEntityDO extends BasetestDO { private String entityType; priva
我遇到了与 Firebase 集成的问题。首先,我在根级build.gradle文件中添加了规则: buildscript { repositories { maven { u
我导入gradle: implementation 'javax.mail:javax.mail-api:1.5.3' 不幸的是,我仍然收到无法加载MailLogger的错误。 2019-07-22
我在这里检查了之前的问题,它似乎是相互冲突的依赖项,但是我似乎找不到错误 Error 06-23 16:41:14.542 7770-7770/net.simplifiedlearning.fireb
以下是我不断在我的应用程序上遇到的 fatal error 。我正在尝试使用 Firebase 在我的应用程序上运行聊天信使功能。它正在运行,但此后一直使应用程序完全崩溃。我对代码进行了一些修改,希望
我正在尝试启动一个带有 Fragment 的 Activity,该 Activity 正在执行 QR 扫描,我正在为此使用这个库 > https://code.google.com/archive/p
LCOM 指标是否适用于 SonarQube 4.2 版本? 我需要将此指标添加到我的报告中,但我看不到它可用。 请让我知道是否需要添加任何特定的 jar 来获取此指标。此指标在 Sonar 3.7
我是一名优秀的程序员,十分优秀!