Android Studio中使用GameCircleSDK时多个dex文件定义了Lcom/amazon/ags/BuildConfig [英] Multiple dex files define Lcom/amazon/ags/BuildConfig when using GameCircleSDK in Android Studio

查看:24
本文介绍了Android Studio中使用GameCircleSDK时多个dex文件定义了Lcom/amazon/ags/BuildConfig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的 Android 项目从 Eclipse 导入到 AndroidStudio.一切都进行得很顺利,我能够解决大多数问题,除非它归结为 GameCircleSDK 库模块.我一直收到以下错误:

I recently imported my Android project from Eclipse into AndroidStudio. Everything went fairly well, and I was able to resolve most issues, except when it came down to the GameCircleSDK library module. I kept getting the following error:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/amazon/ags/BuildConfig;

事实证明,com.amazon.ags.BuildConfig.class 确实包含在两个 jar 中:classes.jar(在构建期间生成)和 GameCircleSDK/libs/gamecirclesdk.jar.

As it turns out, the com.amazon.ags.BuildConfig.class was indeed contained in two jars: classes.jar (which got generated during the build) and GameCircleSDK/libs/gamecirclesdk.jar.

我能解决这个问题的唯一方法是解压缩 gamecirclesdk.jar,删除 BuildConfig.class,然后再次压缩它.我在互联网上搜索了一个解决方案,我尝试了几乎所有列出的内容 here,但似乎没有什么能解决我的情况.我错过了什么吗?

The only way I could solve the issue was to unzip the gamecirclesdk.jar, remove the BuildConfig.class, and zip it back up again. I searched the internets for a solution, and I tried just about everything listed here, but nothing seemed to resolve my situation. Am I missing something?

推荐答案

问题是GameCricleSDK.jar中包含包名为com.amazon.ags"的BuildConfig文件,整个模块也在生成同包的BuildConfig文件清单中声明的​​名称.我在模块清单文件中更改了包名,问题就消失了.

The problem is that GameCricleSDK.jar contains BuildConfig file with package name "com.amazon.ags" and the whole module is also generating BuildConfig file with the same package name as declared in Manifest. I changed the package name in module Manifest file and problem went away.

解决方案:拿 GameCircleSDK 库,打开它的 AndroidManifest.xml 并将 packageName 从com.amazon.ags"更改为 sth else 无论如何.我将其更改为com.amazon.ags.lib".

SOLUTION: Take the GameCircleSDK library, open it's AndroidManifest.xml and change the packageName from "com.amazon.ags" to sth else no matter what. I changed it to "com.amazon.ags.lib".

这篇关于Android Studio中使用GameCircleSDK时多个dex文件定义了Lcom/amazon/ags/BuildConfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆