6

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;

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.

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?

4
  • You'll need to attach your build files to the question to get a better answer. It's not clear what this classes.jar is that got generated during the build, and why it's including that class. Commented Apr 23, 2014 at 16:45
  • The GameCricleSDK library is part of the Amazon Mobile App SDK, it is not my code. Apparently nobody is trying to use this library in Android Studio... Commented Apr 30, 2014 at 4:42
  • I'm an Amazon developer in the games division working on Android. I don't work on the GameCircle team, but I'm going to pass along this issue to them. Commented Jun 12, 2014 at 7:21
  • Thanks for passing this along @SomeCallMeTim! Commented Jun 26, 2014 at 6:27

2 Answers 2

17

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.

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".

Sign up to request clarification or add additional context in comments.

7 Comments

Sorry for the long delay in responding, but can you please provide more detail? Which manifest did you change?
I edited my answer, I hope it's understandable now ;)
Thanks, I looked through AndroidManifest.xml files in my library modules, and found the same package name which I wrongly used for a new module
@mar3kk after changing the package name, it is ok in debug build but I suffer java.lang.NoClassDefFoundError on the release build
Changing the package name in the manifest prevent the class inside the library project to use the respresent in the library project. This is not a solution whera library project is used because it's not possible to add res in a jar
|
0

I ran into the same problem using a different library project though(WeiboSDK). You may also need to change the applicationId in the library's build.gradle file to the same value in the library's AndroidManifest.xml.

1 Comment

AFAiK You cannot set applicationId in library module anymore using recent android gradle plugin.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.