- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
正如标题所说,正在定义多个 dex 文件,我一直在寻找如何解决这个问题,但没有运气,所以我决定接触社区,长话短说,我是将这个遗留项目的 gradle 构建系统从 gradle 0+ 更新到 gradle 3+,我设法重构了常见的配置,例如 flavoring、依赖项(从编译到 api/implementation)、(你的名字......),直到我迷迷糊糊在这个dex问题上,我首先想到的是借助Using gradle to find dependency tree打破依赖关系。 ,但不幸的是,它在 gradlew 命令上花费了我太多时间,并且仍然以 gradlew 问题结束(无法执行 AndroidSdk 的东西),所以我退后一步(以尽量减少我需要的时间)并这样做......(播放赔率)
dependencies {
api (project(':<omitted project name>')) {
exclude group: 'org.apache.commons', module: 'logging'
}
api (project(':<omitted project name>')) {
exclude group: 'org.apache.commons', module: 'logging'
}
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:design:23.1.0'
implementation ('com.google.code.gson:gson:2.3'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.squareup.picasso:picasso:2.5.2'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.squareup.okhttp:okhttp:2.4.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('org.bitbucket.b_c:jose4j:0.5.2'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation (group: 'commons-io',name:'commons-io',version: '2.0.1'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation (group: 'com.jcraft', name: 'jsch', version: '0.1.44-1'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.android.support:design:23.1.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.android.support:appcompat-v7:24.2.1'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.facebook.android:facebook-android-sdk:4.10.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.google.android.gms:play-services:9.8.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.google.android.gms:play-services-gcm:9.0.1'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.google.android.gms:play-services-auth:9.8.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.github.PhilJay:MPAndroidChart:v3.0.2'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation (group: 'org.apache.commons', name: 'commons-compress', version: '1.3') {
exclude group: 'org.apache.commons', module: 'logging'
}
implementation (group: 'org.apache.commons', name: 'commons-vfs2', version: '2.2') {
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
exclude group: 'org.apache.commons', module: 'logging'
}
api fileTree(dir: 'libs', include: ['*.jar'])
api files('libs/nfc7003.jar')
api files('libs/minilcd7003.jar')
api files('libs/Scan7003.jar')
api files('libs/UserInterface.jar')
api files('libs/printer7003.jar')
}
我无法弄清楚上面列表中谁的依赖项与日志框架有这个传递问题,我对它们都定义了一个排除项,仍然没有运气..
只是提一下背后的原因:我需要 Android studio 3 的高级分析,并且必须使用最新的 gradle(4+)/build tool(3+) 才能做到这一点,这让我来到这里。 .
请帮我解决这个问题,在此先感谢...
[编辑] 构建消息:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define
Lorg/apache/commons/logging/impl/LogFactoryImpl$2;
Error:com.android.dex.DexException: Multiple dex files define
Lorg/apache/commons/logging/impl/LogFactoryImpl$2;
Error: at
com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Error: at
com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at
com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at
com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error: at
com.android.builder.dexing.
DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
Error: at
com.android.builder.dexing.
DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
Error: at java.util.concurrent.
ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at
java.util.concurrent.
ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Error: at
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at
java.util.concurrent.
ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error:Execution failed for task '
:<omitted project name>:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException:
com.android.dex.DexException: Multiple dex files define
Lorg/apache/commons/logging/impl/LogFactoryImpl$2;
最佳答案
问题是因为您在 build.gradle 中使用了重复的库。
首先,对于支持库,你需要使用相同的版本。不要使用以下内容:
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:design:23.1.0'
implementation ('com.android.support:design:23.1.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.android.support:appcompat-v7:24.2.1'){
exclude group: 'org.apache.commons', module: 'logging'
}
改为使用以下内容:
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:design:25.4.0'
// appcompat is implicitly include within support design.
其次,对于google play服务,使用相同的版本。不要使用以下内容:
implementation ('com.google.android.gms:play-services:9.8.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.google.android.gms:play-services-gcm:9.0.1'){
exclude group: 'org.apache.commons', module: 'logging'
}
implementation ('com.google.android.gms:play-services-auth:9.8.0'){
exclude group: 'org.apache.commons', module: 'logging'
}
改为使用:
// Dont use the whole play service library
//implementation 'com.google.android.gms:play-services:9.8.0'
implementation 'com.google.android.gms:play-services-gcm:9.8.0'
implementation 'com.google.android.gms:play-services-auth:9.8.0'
第三,要排除常见日志记录,您需要使用如下内容:
compile(group: 'org.apache.commons', name: 'commons-compress', version: '1.3'){
exclude group: 'commons-logging', module: 'commons-logging'
}
或使用以下内容:
configurations.all {
exclude group: "commons-logging", module: "commons-logging"
}
您不需要向每个库添加排除项,因为某些库内部没有任何公共(public)日志记录。
关于android - 多个dex文件定义Lorg/apache/commons/logging/impl/LogFactoryImpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49144242/
val jobConf = new JobConf(hbaseConf) jobConf.setOutputFormat(classOf[TableOutputFormat]) jobConf.s
我为我的项目创建了一个新模块来添加一些额外的功能。在该模块中,我在模块的 Gradle 文件 implementation 'org.jsoup:jsoup:1.10.2' 中添加了 Jsoup 依赖
我已经能够使用出色的任务 appStartWar 或 tomcatStartWar 成功地在tomcat上部署我的Web应用程序 war 文件,但是当我尝试使用 appStart 或到位部署同一Web
我正在使用具有 Maven 支持的 Intellij 启动 tomcat。一旦我添加以下 tomcat maven 依赖项: org.apache.tomc
请帮忙。我正在尝试使用 Jboss 8.1.0 缓存功能做一个简单的缓存机制。这就是我实现项目结构的方式: pomn 文件: 4.0.0 org.jboss
我正在使用 Espresso 进行仪器测试,但在堆栈跟踪中出现此错误: 错误是由缺少的类引起的,如下所示: Caused by: java.lang.ClassNotFoundException: D
早些时候,我的 Android 项目运行良好。但是在更新客户端提供的 .aar 库后,我收到了这个错误。 在我们的项目中,我们没有在任何地方使用 jacoco 依赖项 java.lang.NoClas
我正在尝试使用 wildfly-8 在本地计算机上运行的 Web 应用程序中显示图形报告,但遇到了下一个错误。 java.lang.NoClassDefFoundError: Lorg/jfree/c
我遇到了应用程序崩溃和提供此堆栈跟踪的问题 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/code
我在进行插桩测试时遇到了以下运行时错误。 Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION: Unknown source file : com
这个问题在这里已经有了答案: Android Studio : Error injecting while Appengine backend generation (1 个回答) 关闭 8 年前。
httpPost 在所有 8.1 及以下版本的 android 设备中运行,但在 android 9.0 中运行时出现如下错误, Failed resolution of: Lorg/apache/h
从昨天开始我就有麻烦了。在我的实习中,我遇到了以下构建错误,但我不明白为什么: $ cordova build android [...] FAILURE: Build failed with an
有人可以告诉我如何解决这个问题吗?我试图创建一个新的 Maven 项目,但由于某种原因失败了 描述资源路径位置类型目标 org.apache.maven.plugins:maven-resources
我正在从 Tomcat 6.0.24 升级到 7.0.23。我有一个 maven 2.2.1 项目,它使用 jspc maven 插件预编译 JSP。 当我为我的应用程序部署 WAR 文件并尝试访问
我收到以下错误: Process: com.project.publiko, PID: 27061 java.lang.NoSuchFieldError: No static field INSTAN
错误: E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.azail.cart.debug, PID: 2403
每当我尝试为我的项目构建 APK 时,都会收到以下错误: Error:Error converting bytecode to dex: Cause: com.android.dex.DexExcep
我是用java创建一个strut项目但是报错。我认为此错误是由于缺少 jar 文件造成的,我不知道要下载哪个版本。 这是我的 lib 文件夹中的 jar 文件: commons-digester-2.
我想使用最新的 JUnit 版本: org.junit.jupiter junit-jupiter-engine
我是一名优秀的程序员,十分优秀!