We have a project structure like following:
sharedlib (lib-project, containing classes, that are useful in many apps)
-> main-project (lib-project, containing everything to run the app)
---> 2 branded projects (with different icons/styles for the main-project)
In Eclipse the main project is a library project, referencing the sharelibs in Android Settings and the two branded projects reference the main project as library.
If we compile the branded projects under Eclipse everything works fine, but we could not get ant build (sdk tools r16) to work. We tried several variants for adding the library projects into the branded projects. We got either an error, that the class files of the library project can't be found or the following dex error:
-dex:
[echo] Converting compiled files and external libraries into .../bin/classes.dex...
[apply]
[apply] UNEXPECTED TOP-LEVEL EXCEPTION:
[apply] java.lang.IllegalArgumentException: already added: L.../android/android/lib/R$attr;
[apply] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[apply] at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[apply] at com.android.dx.command.dexer.Main.processClass(Main.java:372)
[apply] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[apply] at com.android.dx.command.dexer.Main.access$400(Main.java:59)
[apply] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[apply] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[apply] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[apply] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[apply] at com.android.dx.command.dexer.Main.processOne(Main.java:313)
[apply] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[apply] at com.android.dx.command.dexer.Main.run(Main.java:185)
[apply] at com.android.dx.command.dexer.Main.main(Main.java:166)
[apply] at com.android.dx.command.Main.main(Main.java:90)
[apply] 1 error; aborting
So the problem is either that our library isn't added at all or added twice. Any ideas, how the ant build file has to look to build the branded projects?