I am trying to get my android application to communicate with the server using the same requestfactories my gwt app does. I use maven to build both the android app and the gwt app. On android when a request-factory call is made I get the exception:
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): java.lang.RuntimeException: No token manifest found. Did the RequestFactory annotation processor run? Check classpath for META-INF/requestFactory/typeTokens file and ensure that your proxy types are compiled with the requestfactory-apt.jar on javac's classpath.
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.google.web.bindery.requestfactory.vm.impl.TypeTokenResolver.loadFromClasspath(TypeTokenResolver.java:104)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.google.web.bindery.requestfactory.vm.InProcessRequestFactory.<init>(InProcessRequestFactory.java:82)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.google.web.bindery.requestfactory.vm.RequestFactorySource.create(RequestFactorySource.java:43)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.myproject.core.android.helper.Util.getRequestFactory(Util.java:97)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.myproject.core.android.Login$1.onClick(Login.java:54)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at android.view.View.performClick(View.java:2501)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at android.view.View$PerformClick.run(View.java:9107)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at android.os.Handler.handleCallback(Handler.java:587)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at android.os.Handler.dispatchMessage(Handler.java:92)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at android.os.Looper.loop(Looper.java:130)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at android.app.ActivityThread.main(ActivityThread.java:3835)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at java.lang.reflect.Method.invokeNative(Native Method)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at java.lang.reflect.Method.invoke(Method.java:507)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
08-05 23:04:33.501: ERROR/AndroidRuntime(22839): at dalvik.system.NativeStart.main(Native Method)
I use java 1.6 for building.My gwt version is 2.4 (rc1). I tried using the maven-processor-plugin and imported requestfactory-apt. But somehow the maven processor-plugin doesn't seem to find a processor. Not sure how the configuration should look.
I have:
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId开发者_开发知识库>maven-processor-plugin</artifactId>
<version>2.0.4-SNAPSHOT</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<<configuration>
<processors>
<processor>com.google.gwt.requestfactory-apt</processor>
</processors>
</configuration>
</execution>
</executions>
</plugin>
The folder for annotations is created in my target folder but it is empty. Does anybody know what the problem could be? What other information do you need?
UPDATE: I changed the version to 2.0.3-SNAPSHOT. Now I get :
[INFO] Source directory: E:\Eclipse\Eclipse3.7\android\target\META-INF\requestFactory added
[INFO] javac option: -cp
[INFO] javac option: C:\profiles\....
[INFO] javac option: -proc:only
[INFO] javac option: -processor
[INFO] javac option: com.google.web.bindery.requestfactory.apt.RfApt
[INFO] javac option: -d
[INFO] javac option: E:\Eclipse\Eclipse3.7\android\target\classes
[INFO] javac option: -s
[INFO] javac option: E:\Eclipse\Eclipse3.7\android\target\META-INF\requestFactory
but there are no files in this folder. When I add:
<compilerArguments>
-Averbose=true</compilerArguments>
</configuration>
to my pom. I get the error-message:
diagnostic warning: The following options were not recognized by any processor: '[verbose]'
Now I am stuck again :-/
The name of the processor class is com.google.web.bindery.requestfactory.apt.RfApt
, however it should be automatically discovered without the need for the explicit <configuration>
section.
Also, you have <<configuration>
in the sample code, is that a copy-and-paste error?
This might help you, RequestFactoryInterfaceValidation
Try using the RequestFactory ValidationTool
精彩评论