Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple dex files define Lcom/amazon/ags/BuildConfig when using GameCircleSDK in Android Studio

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?

like image 561
rossman Avatar asked Apr 23 '14 06:04

rossman


1 Answers

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

like image 163
mar3kk Avatar answered Sep 22 '22 17:09

mar3kk