Android build issues

jvdw007

New Member
Joined
Feb 21, 2019
Hey guys,

I've been a long time Monkey-X user and my last game I released January last year was using Monkey-X version 86e. Since then I've not done much modern game dev stuff but am now getting back into it.
I have installed the latest version of Cerberus-X but I'm having endless issues building for Android.
I've got the latest Java version installed too (version 11.0.2 or something) and I have checked my Path and JAVA_HOME values:

JAVA_HOME has:
C:\Program Files\Java\jdk-11.0.2

JDK_HOME has:
%JAVA_HOME%

Path has:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\DevTools\TDM-GCC-32\bin;C:\Program Files\TortoiseSVN\bin;C:\KickAssembler\KickAss.jar;C:\WinVICE-2.4-x64\;C:\DevTools\AndroidSDK\platform-tools\;%JAVA_HOME%\bin;C:\Program Files\nodejs\;C:\exomizer-3.0.1\win32\;

Before I installed the above version of Java, I had a build error where the sourcefile was not version 1.7. So I thought I'd install the latest version to see what happens.
Now it's gone even more tits up:

TRANS cerberus compiler V2018-08-10
Parsing...
Semanting...
Translating...
Building...
Support for running Gradle using Java 7 has been deprecated and is scheduled to be removed in Gradle 5.0. Please see https://docs.gradle.org/4.4/userguide/java_plugin.html#sec:java_cross_compilation for more details.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\cerberus-v2018-12-30\examples\mojo\ferdi\snake\snake.buildv2018-12-30\android\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
* 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
BUILD FAILED in 2s
TRANS FAILED: Android build failed.

My config.winnt.txt has these in for Java:
JDK_PATH="${SYSTEMDRIVE}\devtools\JDK"
JDK_PATH="${SYSTEMDRIVE\Program Files (x86)\Java\jdk1.6.0_45"
JDK_PATH="${SYSTEMDRIVE\Program Files (x86)\Java\jre1.8.0_201"
JDK_PATH="${SYSTEMDRIVE\Program Files\Java\jdk-11.0.2"

So I thought, since I can't seem to buid Android on Cerberus, let me go back to building on Monkey-X instead, but the problem then is that it builds but when you install the .apk on your phone, the phone reports "This app was built for an older version of Android and may not work properly"
This confirms my suspicions then that if I build with this, Google Play store reports my game(s) to be incompatible with my device(s), which means other people too would see this and therefore not buy it, which is pointless.

This means I really have to get Cerberus-X workign with Android, but it does something that Monkey-X does not, in that it uses Gradle to build Android apps, and I'm not familiar with Gradle or how to make it all play nice.

Can anyone help me or suggest what I can do to get Android to build on the latest version of Cerberus? My dev box is running Windows 7 Pro.

Thanks,
Jaco.
 

jvdw007

New Member
Joined
Feb 21, 2019
Did you install Android Studio?
Hi Mike,

Thanks for answering. Yes, I've had Android studio installed all along, however I didn't think of loading it up until you mentioned it.
It came up with an error when loading:
"Failed to load JVM DLL C:\Program Files\Java\jdk11.0.2\bin\server\jvm.dll - If you already have a 32bit JDK installed, define a JAVA_HOME variable in Computer -> System Properties -> System Settings -> Environment Variables"

I already have a 32bit JDK installed, so when I point to that path in JAVA_HOME instead of the Program files path, Android Studio loads fine.
However, Cerberus still fails to build and gives the same error as in the previous post.
 

jvdw007

New Member
Joined
Feb 21, 2019
I think another question I would have for everyone here, is, if you wanted to target a newer or specific version of Android, what files need to be changed accordingly?
I have already tried to make a new target for Android, but it still seems to use the specific Android SDK Revision. How do you change Cerberus to use a different revision of Android SDK?
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
isnt this the problem? theres no version 52. Android SDKs are on version 28 roughly. (I could check but that would require effort)
Its either in your code or in the androidmanifest.xml file in templates
I may be wrong
 

jvdw007

New Member
Joined
Feb 21, 2019
Hi there Rich.
I didn't change the xml file.
This is a fresh download of Cerberus-X and loading up an Example file (ferdi-snake) etc.

I have in the meantime downloaded Gradle and added it to the path environment variable, along with checking and adjusting the java paths as can be seen in the screenshot attached.
As you can clearly see, there is the latest Gradle, latest Java, correct paths and versions being reported, yet Cerberus keeps stating Gradle is using JDK 7 and not 8. I've rebooted multiple times etc too, to ensure the profile is used.
 

Attachments

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
Let me compare with my settings.. I'll get back to you
 

Rich

Active Member
3rd Party Module Dev
Joined
Sep 9, 2017
Hi
Ive checked my settings and I dont have any paths for JAVA_HOME or JDK_HOME in my system variables. Ive checked my path env var and its not in there too.
The path to my JDK is only referenced in my config.winnt.txt file in c:\dev\bin\Cerberus\bin
Code:
JDK_PATH="C:\dev\bin\jdk1.8.0_144"
'--------------------

'--------------------
'Android SDK and tool paths.
'
'Must be set to a valid dir for ANDROID target support
'
ANDROID_PATH="c:\dev\bin\Android\SDK"
 

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Location
Germany
This is my config file:

Code:
'--------------------
'Cerberus modules path
'
'Can be overriden via transcc cmd line
'
MODPATH="${CERBERUSDIR}/modules;${CERBERUSDIR}/modules_extX;C:/Users/mike/Desktop/CerberusX/CerberusModules"
'--------------------

'--------------------
'HTML player path.
'
'Must be set for HTML5 target support.
'
'for opening .html files...
'
HTML_PLAYER="${CERBERUSDIR}\bin\cserver_winnt.exe"
'--------------------

'--------------------
'MinGW path.
'
'Must be set to a valid dir for desktop/stdcpp target support.
'
'MinGW is currently here:
'
'***** DO NOT use mingw64-5.1.0 as it has a linker bug *****

'***** 64 bit mingw *****
MINGW_PATH="D:\TDM-GCC-64"
'--------------------

'--------------------
'Java dev kit path
'
'Must be set to a valid dir for ANDROID and FLASH target support
'
'The Java JDK is currently available here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
'
JDK_PATH="D:\Program Files (x86)\Java\jdk1.8.0_181"
'--------------------

'--------------------
'Android SDK and tool paths.
'
'Must be set to a valid dir for ANDROID target support
'
ANDROID_PATH="D:\Program Files\Android\Android Studio"
'--------------------

'--------------------
'Android NDK
'
'Must be set to a valid dir for ANDROID NDK target support
'
'ANDROID_NDK_PATH="D:\Program Files\Android\Android Studio\ndk-bundle"
'--------------------

'--------------------
'Ant build tool path
'
'Must be set to a valid dir for FLASH target support
'
'Ant is currently available here: http://ant.apache.org/bindownload.cgi
'
ANT_PATH="D:\Programme\apache-ant-1.9.7"
'--------------------

'--------------------
'Flex SDK and flash player path.
'
'FLEX_PATH Must be set for FLASH target support.
'
'Either HTML_PLAYER or FLASH_PLAYER must be set for FLASH target support.
'
FLEX_PATH="c:\flex_sdk_4.6"
'for opening .swf files...cerberus will use HTML_PLAYER if this is not set.
'FLASH_PLAYER="...?..."
'--------------------

'--------------------
'Play Station Mobile SDK path.
'
'PSM_PATH must be set for PSM target support.
'
PSM_PATH="d:\devtools\PSM_SDK"
'--------------------

'--------------------
'MSBUILD path.
'
'Must be set for XNA and GLFW target support.
'
'MSBUILD_PATH="C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"
MSBUILD_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe"
'MSBUILD_PATH="${PROGRAMFILES}\MSBuild\12.0\Bin\MSBuild.exe"
'MSBUILD_PATH="${WINDIR}\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
'--------------------

'--------------------
' AppGameKit path.
'
'Must be set for AGK support.
'
AGK_PATH="D:/Program Files (x86)/The Game Creators/AGK2"
'
'--------------------

'--->> BEGIN OF JUNGLE IDE GENERATED CONFIG
'--->> END OF JUNGLE IDE GENERATED CONFIG
These are the java versions I have installed:

1550773894899.png


These are the SDK platforms I have installed in Android Studio:

1550773692787.png


The SDK tools are these. Not all are needed but it doesn't hurt to install them:

1550773717920.png


There is a problem with the minSDK Target setting, it is already set to to 26. On Github it is already corrected. But
even with the current official version you should have it be building.

I have installed Android Studio and the Java jdk normally, nothing special. And I didn't had to set any paths manually.

Here it builds just fine.
 

jvdw007

New Member
Joined
Feb 21, 2019
Rich and Mike, I just want to say THANK YOU!

After having a break for a few hours (as my brain was melting), I uninstalled all the various java versions I have, removed all the environment variables as Rich mentioned, made my config.winnt.txt like Mike's, then installed the same Java versions as Mike.
I then rebooted to make sure, loaded up a Mojo example and it worked! Only complaint was at the end it "failed" as it wasn't able to find a connected device or emulator, which is not a problem as I just drag the built .apk file to dropbox, then install it from there on my phone to test.
I have a One Plus 6T with Android 9 on, so it was great to see the app build and run with no complaints on the phone about it being out of date.
Blobmonster is surprisingly soothing to watch on your phone :)

One final weird thing I noticed as I was typing this response, was that I actually forgot to change/un-comment the JDK_PATH variable, so there's nothing in config.winnt.txt telling Cerberus where Java is, yet it works. If however, something fails to build in the future, I'll remember to uncomment that JDK_PATH variable and point it to the correct install folder.

So, thanks once again!
 
Top Bottom