Closed GoogleCodeExporter closed 8 years ago
This error is thrown by dx command when two classes with the same name and
package name are detected.
Have you placed both the androidannotations-X.Y.jar and
androidannotations-X.Y-api.jar in the "libs" folder of your project ?
All the jars installed in the "libs" folder are directly passed to the dx
command, and so, they are packaged in dex format in your apk file. This is not
good because a lot of code that is not used at runtime is embedded in your apk .
The only (relatively acceptable) workaround I found is :
- Remove androidannotations-X.Y.jar from the "libs" folder (let the
androidannotations-X.Y-api.jar in this folder) and install it in another folder
("compile-libs" for this example)
- Override the "-compile" target of the imported ant build file by copying it
from the $ANDROID_SDK$/tools/ant/build.xml to your $PROJECT_ROOT$/build.xml
- add the content of "compile-libs" to the classpath when <javac> is invoked
(in the "-compile" target of your $PROJECT_ROOT$/build.xml) :
<javac ...>
...
<classpath>
<fileset dir="compile-libs" includes"*.jar"/>
...
</classpath>
</javac>
You're right, working with ant + android + androidannotations is not easy at
the moment, we are working on the documentation for automated builds.
Original comment by mat.boni...@gmail.com
on 28 Dec 2011 at 4:22
https://github.com/excilys/androidannotations/issues/23
Original comment by py.ricau
on 6 Jan 2012 at 3:54
Original issue reported on code.google.com by
johngray...@gmail.com
on 28 Dec 2011 at 3:12