HOW TO: Build Android target

When building the Release config c++ tool target, I get:

main.cpp:1529:5: warning: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
^
main.cpp:1590:5: warning: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
^
main.cpp:14522:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
 
main.cpp:1529:5: warning: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
^
main.cpp:1590:5: warning: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
^
main.cpp:14522:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
You can ignore them. They are only warnings.
The first two are in modules/cerberus/native/lang.cpp and should be changed to #ifdef TARGET_OS_IPHONE

The last one is in cerberus/src/transcc/native/image.cpp in the function get_file_contents. It needs to be really modified to return an empty std::string by adding either return std::string(); or return {}; and the calling function to deal with the result.
 
After doing the install (which worked, seemingly - thank you!!!) I get this when compiling:
(what's wrong now? something with diddy?)

"/Applications/Cerberus/bin/transcc_macos" -target=Android_Game -config=Release -run "/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.cxs"

TRANS cerberus compiler V2021-03-21

Parsing...

Semanting...

Translating...

Building...

Starting a Gradle Daemon (subsequent builds will be faster)

:app:clean

:app:checkReleaseClasspath

:app:preBuild UP-TO-DATE

:app:preReleaseBuild

:app:compileReleaseAidl NO-SOURCE

:app:compileReleaseRenderscript

:app:checkReleaseManifest

:app:generateReleaseBuildConfig

:app:prepareLintJar UP-TO-DATE

:app:mainApkListPersistenceRelease

:app:generateReleaseResValues

:app:generateReleaseResources

:app:mergeReleaseResources

:app:createReleaseCompatibleScreenManifests

:app:processReleaseManifest

:app:splitsDiscoveryTaskRelease

:app:processReleaseResources

:app:generateReleaseSources

:app:javaPreCompileRelease

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2872: error: package MonkeyGame.app does not exist

MonkeyGame.app.input.keyStates = 0;

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2880: error: cannot find symbol

GL11 gl = MonkeyGame.app.graphics.gl;

^

symbol: class GL11

location: class diddy

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2880: error: package MonkeyGame.app does not exist

GL11 gl = MonkeyGame.app.graphics.gl;

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2882: error: package MonkeyGame.app does not exist

gl.glReadPixels((int)x, (int)MonkeyGame.app.graphics.height - y, 1, 1, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixelBuffer);

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2896: error: package MonkeyGame does not exist

return MonkeyGame.app.updateRate;

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2952: error: package MonkeyGame does not exist

android.view.inputmethod.InputMethodManager inputMgr = (android.view.inputmethod.InputMethodManager)MonkeyGame.activity.getSystemService(android.content.Context.INPUT_METHOD_SERVICE);

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2958: error: cannot find symbol

alert = new AlertDialog.Builder(MonkeyGame.activity);

^

symbol: variable MonkeyGame

location: class diddy

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2962: error: cannot find symbol

input = new EditText(MonkeyGame.activity);

^

symbol: variable MonkeyGame

location: class diddy

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2987: error: package MonkeyGame does not exist

MonkeyGame.activity.startActivity(launchBrowserActivity);

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:2997: error: package MonkeyGame does not exist

MonkeyGame.activity.startActivity(emailIntent);

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:3017: error: package MonkeyGame does not exist

vibrator = (Vibrator)MonkeyGame.activity.getSystemService(Context.VIBRATOR_SERVICE);

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:3086: error: package MonkeyGame does not exist

myManager = (LocationManager)MonkeyGame.activity.getSystemService(Context.LOCATION_SERVICE);

^

/Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java:3099: error: package MonkeyGame does not exist

MonkeyGame.activity.runOnUiThread(new Runnable() {

^

Note: /Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: /Users/layoutcenter/Desktop/game table/igtbrainfrog/igtbrainfrog.buildv2021-05-16/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

13 errors

:app:compileReleaseJavaWithJavac FAILED



FAILURE: Build failed with an exception.



* What went wrong:

Execution failed for task ':app:compileReleaseJavaWithJavac'.

> Compilation failed; see the compiler error output for details.



* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.



* Get more help at https://help.gradle.org



16 actionable tasks: 15 executed, 1 up-to-date

BUILD FAILED in 21s

TRANS FAILED: Android build failed.

Done.
 
Did you try opening the project in Android Studio and rename all occurences of MonkeyGame to CerberusGame?
Did you try to build Diddy examples? Maybe some native code has to be changed in Diddy to make it work.
 
(what's wrong now? something with diddy?)
Well you are using a module that was written for Monkey and hasn't had any official update in over eight years. So I would say yes, you're going to get a lot of problems.

You could try using transcc_macos command line to build, just in case it's the version of Ted that comes with that Cerberus version.

Did you try to build Diddy examples? Maybe some native code has to be changed in Diddy to make it work.
I've cloned the diddy development branch and can confirm a fair few changes have to be made to get that to work just for the desktop target. A lot of the examples will not work, or only partially work with just the few changes I've made.
The first thing is swapping all the Alisa referencing monkey modules to cerberus modules. Anything for Android will be well out of date.
 
What was Diddy actually used for? I had a version called "smalldiddy" that someone made with reduced commands and quicker compilation time. I removed it and the game still runs.

Now I get this message:

adb: no devices/emulators found
- waiting for device -

I installed everything according to dawlane's post. Do I need an additional emulator or something? Or did I forget something?
(sorry, I'm completely new to Android)
 
I installed everything according to dawlane's post. Do I need an additional emulator or something? Or did I forget something?
Yes you need to install an emulator. You can do this from Android Studio under the AVD manager.
Note that your system must be able to run an AVD and it has to be running before building.
The easiest is to use and Android device that has developer mode enabled.
 
It says my CPU doesn't support VT-x. So I guess it's not possible to run that.

If I want to try it on an Android device, my instruction says "copy your APK to a thumb drive ...".
"Your APK" ... is that the folder named apk inside .build.../android/app/build/outputs/ correct?
Or just the .apk file inside that folder? Or also the .json file? Or is that anything else/more?
 
Just the APk. But just enable your device for developing and connect it. Then it will be installed automatically.
 
Back
Top Bottom