Hi Oscar, Retrotranslator does it's job by modifying compiled classes in the following way: 1. Embedding into each class its metadata (including annotations) as one big character string. 2. Replacing some method invocations, so java.lang.Class.isAnnotationPresent is being replaced with net.sf.retrotranslator.android.main.java.lang.Class.isAnnotationPresent etc. So when you call getAnnotations() on a particular class the code from retrotranslator-android-1.2.6.jar will parse the corresponding metadata and return the result. AFAIK when you run your Android project from Eclipse it both compiles your sources into classes and the classes into a dex file. So Retrotranslator has no chance to modify classes in between unless you fix the ADT plugin. The workaround is not to put your sources into Eclipse and to process it with javac, Retrotranslator and jar manually. After that you may add the jar to Eclipse. If you execute the following line you should obtain mytuscany-android.jar that is one-third bigger then the original mytuscany.jar and does not contain references to Java 5 reflection methods. | Code Block |
|---|
java -jar retrotranslator-transformer-1.2.6.jar -srcjar mytuscany.jar
-destjar mytuscany-android.jar -target 1.5 -reflection safe -stripannot
-classpath retrotranslator-android-1.2.6.jar
|
So the line java.lang.Class.isAnnotationPresent(Class.java:1131) in the stack trace means that the application is based on non-translated binaries. Maybe you had successfully processed your classes but Eclipse overwrote them after that or Eclipse had already created the dex file before you executed Retrotranslator. If you're using Eclipse the most elegant way would be to add the translation step to the ADT plugin source code, but otherwise don't include Tuscany sources into the project, only include a jar processed by Retrotranslator and retrotranslator-android-1.2.6.jar. Cheers, Taras. |