Question

I've got an Android app which (in theory) can be turned into a library and dropped into an external application. The external app can then create a tab which will contain my app. The library app is set up in a similar manner to the google-play-services library where the code is stored in a jar file in the libs folder.

The first issue I experienced was that I was getting

Unable to execute dex: Multiple dex files define Lcom/MyLibraryApp/R$anim

when I tried to run the external application in the emulator. After a lot of googling and dead ends, I was able to get the external app to run by unchecking the "Android Private Libraries" in the "Order and Export" section of the build path menu. But when I go to the tab that calls onto the library app, I get

java.lang.NoClassDefFoundError: com.MyLibraryApp.SplashScreen 

and after checking on here, it seems that the solution to this is to re-check the "Android Private Libraries". So I'm in kind of stuck because either I check the Android Private Libraries and get the Multiple Dex Files issue or un-check it and get a NoClassDefFoundError.

Has anyone come across this kind of issue before?

Was it helpful?

Solution

Turns out that the issue was that the jar I created for the library app contained the R.class and Manifest.class files from the original application. Eclipse/ADT then created a second copy of these in the gen folder. This question is what tipped me off to look inside the jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top