HOW TO: Build Android target

How to check version of Android Studio? API?
You'll find that by starting Android Studio. In the projects Welcome screen, click more actions and select the SDK Manager to see what Android SDK's are installed as seen in the images in post #31.
How to check version of the JDK?
Open a terminal and type:
javac -version

WARNING: Before making changes to any of the files mentioned. Make sure that you know how to enter the recovery console if things go wrong. A typo here can cause your system to fail to log in correctly.
If you see an error, then you will have to either install a Java JDK from some place like Oracle or download an archive from https://openjdk.org/, or use the one that comes with Android Studio. Both openjdk and android requires that you either create, or modify the hidden system shell file to include the path to the JDK as explained here.

NOTE: It say JAVA_HOME, but you should also add the location to where the javac application is to the system path. e.g.
export PATH="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin:$PATH"

NOTE: It is very important that when adding things to the PATH environment variable that the path variable it's self is also added. Else ithe system WILL fail to boot to login correctly.

And is there any reason as to why you are using an older version of Cerberus X?
The current release is v2022-03-20
 
Last edited:
Here's the info:

javac -version
javac 1.7.0-ea

And see screenshots.

BTW, I don't need Google Play (Store), I just need it to run on one certain device. No ads, no store.

What's missing?

(I really hate this type of stuff. I'm a game designer, and I can code, and that's what I want to do. I don't want to do system admin stuff.)

Bildschirmfoto 2023-03-23 um 14.34.21.png
Bildschirmfoto 2023-03-23 um 14.35.32.png
 
javac 1.7.0-ea
That is too old. You need JDK 1.8 at a minimum.
The one that comes with Android Studio 2022.1.1 (Electric Eel) is version 11.0.15.
Your choices on a Mac are limited to:
  • Download and install a pkg version of the JDK from Oracle. Not recommended with their changes in licencing.
  • Download, extract the archive from openjak.org, and set the paths in the hidden config file.
    • Make sure that you read up on how to start the machine and use the recovery console and use a command line editor such as nano if you mess it up.
  • Install a package manager such as homebrew or macports, then install it via one of those.
  • Try a third-party site that has pre-built JDK pkg files. One such site is https://www.openlogic.com/
    • I don't like using third-party, as you never know what you could be getting.
And install the platform SDK of the target Android OS that you wish to deploy to.

You should also use a more recent version of Cerberus-X that has an updated version of gradle
(I really hate this type of stuff. I'm a game designer, and I can code, and that's what I want to do. I don't want to do system admin stuff.)
All programming development tools require that you install an SDK if you want to do more than just write a program that prints "Hello World". Tools such as Android Studio, Visual Studio and Xcode make it easy to install the required items. Only those tools that have a full time development team working on them make things that easy.

As an individual, you have to learn how to install the required SDK's, and in some cases build it from scratch.
 
Now it's javac 20.

Compiling gives me this:

TRANS FAILED: Android build failed.

* What went wrong:

Could not determine java version from '20'.
 
Could not determine java version from '20'.
Now you have a JDK version that's too new. And not supported by Android.

This should give you a clue as to the version being used.
"The one that comes with Android Studio 2022.1.1 (Electric Eel) is version 11.0.15."
 
Just heads up. At work we avoid electric eel on the Mac and use an older version.
 
I was looking for game dev tools, where you DON'T need to install anything.
So far no luck. Unity, Godot, GameMaker, B4A, AppGameKit.... they all want you to install Android Studio or an Android SDK at least.

I think the online builds service with GDevelop will create an ABB for you. But I am not 100% certain. Maybe Construct 3 does as well.
Back in the day when Corona SDk was a thing, they did the same.
 
What's the issue with eel?
I just heard from collegues not to use it, because it has issues.

Maybe this one: https://www.youtube.com/watch?v=ry_Zyyq-ZDQ

Anyway, maybe their experience is now older, I just used the second last version then. It works and that is what is needed. We code in SubLime anyway and use crazy build scripts to add things and build the executable for different modes. Crazy shit, but somehow it works.
 
That video was dated two months ago. And looks to be flutter related.
If anything. I'd have thought it would have been a JDK version compatibility issue that would be the main cause of any problems. Easy to solve in most cases when using gradle by loading the project into Android Studio and opening up the settings to use a different gradle JDK.
Currently Eel's on patch 2 as of the back end of February.

Plus, I don't know why the person that created that video copied the whole JDK directory. Could have just go away with creating a jre system link to the jbr folder.
We code in SubLime anyway and use crazy build scripts to add things and build the executable for different modes.
Problem with build scripts is that they tend to get over complicated. But then, someone would have to be slightly nuts to write them to start with.
The number of times I've had to go back to my notes, online manuals or a good book to figure out how to do something. Failing that, then it's my friend google.
 
Last edited:
It's possible to make it very simple for Android development, B4A (Android version of B4X) does it. They choose to package the open package as files for download as a zip. You download and unzip and in the IDE you point set the path and you cmopile perfeclty without Android Studio or any orher files. (You can see what they do here, it i s step 1 and 2. https://www.b4x.com/b4a.html
 
I choose to download the zips inside the actual tool folder itself and have a portable version. So i do not need JAVA at all on my computer installed to devlop Android on the go.
 
@Wingnut You have to have the correct version of Java installed. You were just lucky to have it.
If you statement is correct, then the instructions on the B4A site makes no sense regarding installation of JAVA and Android SDK and tools.
 
well first time i had to install JAVA in step 1.. android SDK is provided as zip there so it was just downloaded. After my first install of JAVA , i could just reuse the folder I dont think i needed to reinstall everytime but my memoery is no thtat good so can say 100%. I think you are right that i was lucky regarding the version etc, that was how I felt too.
 
I just heard from collegues not to use it, because it has issues.

Maybe this one: https://www.youtube.com/watch?v=ry_Zyyq-ZDQ

Anyway, maybe their experience is now older, I just used the second last version then. It works and that is what is needed. We code in SubLime anyway and use crazy build scripts to add things and build the executable for different modes. Crazy shit, but somehow it works.
How come you use Sublime instead of VisualStudio Code, I'm just curious I love both, Sublime for its speed, and VSC for its many extensions. I'm lazy so I just stick with one. Does sublime has special features you need where you develop, or is it becuase it is more comfertable to use?
 
I'm still stuck with this. Even more confused now. What do I have to do to compile for Android, step by step, in easy understandable language, pleeeeeaaaaase???

(I need to build apps compatible with Android 9 and 11)
 
Last edited:
Will see what I can do. So far I am unable to build on MacOS 12.6.4 and Android studio as well. On Windows it works.
Will investigate.
 
Will see what I can do. So far I am unable to build on MacOS 12.6.4 and Android studio as well. On Windows it works.
Will investigate.
Already done it for the current download version.
You need to use Android Studio 4.3.1 as that has JDK8. Plus a couple of changes to transcc to locate the JDK.

First outline.
First task is to remove any installed files relating to Android.
Open Finder and make changes to show the users home directory and the hard disk. These is located via the preferences under the side-bar icon in the Favourite and Locations section.

Open the home directory in Finder and switch to show hidden files mode. Key combo Command+Shift+Period(.)

Locate and send the following to the recycle bin.
.gradle
.Library/Android
/Applications/Android Studio.app

NOTE: The Library in the users home directory is a hidden folder and contains other program data. Only remove the sub directory named Android as this contains the Sdk.


NOTE: JDK installations are whole directories and will be located in the following locations:
$HOME/.Library/Java/JavaVirtualMachines
/Library/Java/JavaVirtualMachines

They can be left as they are as changes need to be made to transcc for it to pick up where it needs to find the JDK.

Now to install a version of Android that is compatible with Cerberus-X 2021-05-16.
Got to the web site https://developer.android.com/studio/archive and agree to the usage etc.
Look for Android Studio 4.1.3 and download. Do not forget to check the sha256 check sum in the associated link by opening a terminal, changing directory to where Android Studio has just been downloaded to. Then execute the command:
shasum -a 256 android-studio-ide-201.7199119-mac.dmg

Compare the result against the version in the link. If they are different, then there is something wrong with the file.

If all is okay, then open the dmg file and install Android Studio.

Once Android Studio is installed, open the Android Studio application to begin setup.
If asked for a JDK/Java location, then leave it as it is.
If asked where to place the Android SDK, leave it as it is.
It will then download the required files.

Eventually. It will show the Android Studio Welcome dialog. Here select the "Configure" dropdown and select "SDK Manager".

Here select the required SDK Platforms to download and deselect the ones not needed and then click Apply. Accept any licence and start the installation. Once everything is downloaded. Then Android Studio can be closed.

If not already installed. Install Cerberus X.
Some changes need to be made to transcc, so start Cerberus and open up the transcc.cxs file located in the Cerberus/src/transcc directory.
Make a copy of this file as a back up.
In the method LoadConfig after line 506 add the following.
If JDK_PATH path=JDK_PATH+"/bin:"+path
If JDK_PATH SetEnv "JAVA_HOME",JDK_PATH

Save the file and build transcc as a Release config C++ Tool target.

Now open the config.macos.txt file located in Cerberus/bin and add the following to the end of the file.
JDK_PATH="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"

Now it's time to move the main_macos program located in the Cerberus/src/transcc/transcc.buildv2021-05-16 to Cerberus/bin
Rename the transcc_macos already there to transcc_macos_bak and then change the name of the main_macos to transcc_macos.
 
Last edited:
Back
Top Bottom