Compile error: 'void' type not allowed here
Monkey Targets Forums/Android/Compile error: 'void' type not allowed here
| ||
HI, I get the folling error when compiling for android, the other targets works fine: [javac] Note: F:\watch_the_skies\wts2012\cc_app.build\android\src\com\monkey\MonkeyGame.java uses unchecked or unsafe operations.ERROR: BUILD FAILED trans_winnt.exe -run -config=release -target=android "F:\watch_the_skies\wts2012\cc_app.monkey" TRANS monkey compiler V1.34 Parsing... Semanting... Translating... Building... * daemon not running. starting it now on port 5037 * * daemon started successfully * Buildfile: F:\watch_the_skies\wts2012\cc_app.build\android\build.xml -pre-clean: clean: [delete] Deleting directory F:\watch_the_skies\wts2012\cc_app.build\android\bin [delete] Deleting directory F:\watch_the_skies\wts2012\cc_app.build\android\gen BUILD SUCCESSFUL Total time: 0 seconds Buildfile: F:\watch_the_skies\wts2012\cc_app.build\android\build.xml -set-mode-check: -set-debug-files: -set-debug-mode: -debug-obfuscation-check: -setup: [echo] Gathering info for MonkeyGame... [setup] Android SDK Tools Revision 16 [setup] Project Target: Android 3.2 [setup] API level: 13 [setup] [setup] ------------------ [setup] Resolving library dependencies: [setup] No library dependencies. [setup] [setup] ------------------ [setup] [setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (3) is lower than the project target API level (13) -build-setup: [echo] Creating output directories if needed... [mkdir] Created dir: F:\watch_the_skies\wts2012\cc_app.build\android\bin [mkdir] Created dir: F:\watch_the_skies\wts2012\cc_app.build\android\bin\res [mkdir] Created dir: F:\watch_the_skies\wts2012\cc_app.build\android\gen [mkdir] Created dir: F:\watch_the_skies\wts2012\cc_app.build\android\bin\classes -pre-build: -code-gen: [echo] ---------- [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [renderscript] No RenderScript files to compile. [echo] ---------- [echo] Handling Resources... [aapt] Generating resource IDs... -pre-compile: -compile: [javac] Compiling 2 source files to F:\watch_the_skies\wts2012\cc_app.build\android\bin\classes [javac] F:\watch_the_skies\wts2012\cc_app.build\android\src\com\monkey\MonkeyGame.java:15748: error: 'void' type not allowed here [javac] return ((new bb_boxes_IntObject()).g_new(bb_std_lang.print((t_ instanceof bb_boxes_StringObject ? (bb_boxes_StringObject)t_ : null).f_value))); [javac] ^ [javac] F:\watch_the_skies\wts2012\cc_app.build\android\src\com\monkey\MonkeyGame.java:15758: error: 'void' type not allowed here [javac] return ((new bb_boxes_IntObject()).g_new(bb_std_lang.error((t_ instanceof bb_boxes_StringObject ? (bb_boxes_StringObject)t_ : null).f_value))); [javac] ^ [javac] Note: F:\watch_the_skies\wts2012\cc_app.build\android\src\com\monkey\MonkeyGame.java uses unchecked or unsafe operations.ERROR: BUILD FAILED C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:602: The following error occurred while executing this line: C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:622: Compile failed; see the compiler error output for details. Total time: 2 seconds [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 2 errors ERROR: TRANS FAILED: Android build failed. Error in compilation! Does anyone know how to solve this? |
| ||
Can you compile this in debug mode and view the generated code, then find the line:return ((new bb_boxes_IntObject()).g_new(bb_std_lang.print((t_ instanceof bb_boxes_StringObject ? (bb_boxes_StringObject)t_ : null).f_value))); Around that line you should be able to see a Monkey line number, then look at your Monkey code and post the line here. |
| ||
Unfortunately there is no line number at the generated FunctionInfo.Invoke code. My other programs works fine on android, but the generated reflection code does also not contains the invoke methods for "monkey.lang.Print" and "monkey.lang.Error".... class bb_reflection_R32 extends bb_reflection_FunctionInfo{ public bb_reflection_R32 g_new(){ super.g_new("monkey.lang.Print",1,bb_reflection.bb_reflection__intClass,new bb_reflection_ClassInfo[]{bb_reflection.bb_reflection__stringClass}); return this; } public Object m_Invoke(Object[] t_p){ Object t_=t_p[0]; return ((new bb_boxes_IntObject()).g_new(bb_std_lang.print((t_ instanceof bb_boxes_StringObject ? (bb_boxes_StringObject)t_ : null).f_value))); } } class bb_reflection_R33 extends bb_reflection_FunctionInfo{ public bb_reflection_R33 g_new(){ super.g_new("monkey.lang.Error",1,bb_reflection.bb_reflection__intClass,new bb_reflection_ClassInfo[]{bb_reflection.bb_reflection__stringClass}); return this; } public Object m_Invoke(Object[] t_p){ Object t_=t_p[0]; return ((new bb_boxes_IntObject()).g_new(bb_std_lang.error((t_ instanceof bb_boxes_StringObject ? (bb_boxes_StringObject)t_ : null).f_value))); } } |
| ||
I've been getting the same exact error when deploying on Android. Have you been able to fix this? |
| ||
So the problem was because I didn't add a reflection filter, even when I just imported reflection and tried to deploy on android I got error. |
| ||
I was not able to fix this... with or without reflection filter, doesnt matter. In my oppinion, this sems like a bug, since the the monkey code is ok...all targets works fine, only the generated java code causes this error... Obviously it is necessary to test against all targets as much as possible... |
| ||
You need to provide a Monkey code example which Mark can use to fix this issue. Try to narrow down the Monkey code and post it here once you get the same results (ie the compiler error). |