• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Compile Android Build

msmalik681

OpenBOR Developer
Staff member
Compile Android Build on Windows 10

First Download the latest JAVA JDK for windows 10 x64 from Oracle website and install it. (32-bit windows needs jdk 8 for x86)

Now you can setup your environment variables use the search bar to search for "advanced system settings" that window will have a button at the bottom for "Environment Variables" now select "New" under "user variable":

  • "ANDROID_HOME" = "C:\android\sdk"


Now setup System Variables -> Path add these lines:

  • "C:\Program Files\Java\jdk-13\bin" (note "jdk-13" this folder may be different based on your version installed)
  • "C:\android\sdk\cmdline-tools\version\bin" (for x86 legacy version use "C:\android\sdk\tools\bin")
  • "C:\android\sdk\build-tools\28.0.3"
  • "C:\android\sdk\ndk-bundle"

for windows 7 add them like this ";C:\Program Files\Java\jdk-13\bin\;C:\android\sdk\tools\bin\;C:\android\sdk\build-tools\28.0.3\;C:\android\sdk\ndk-bundle\"

Now download the Android SDK get the "command line tools only" package for windows near the bottom of the page and save it. Extract the bin folder to "C:\android\sdk\cmdline-tools\version\" folder (if you do not have this path make it).

For the Android command line tools (windows x86) build extract the tools folder to "C:\android\sdk\".

Now you can run the file "sdk-setup.bat" (found in root of openbor android folder) and it should download everything you need (if your sdk folder is in a different location edit the "sdk-setup.bat" to point to yours). for 32bit windows download the x86 version of the "command line tools" links are below.

Now restart your PC. To test the NDK open command prompt and type "ndk-build" and for java type "java -version" if they are recognised commands your all set.

Custom Apk instructions

First ensure you can view file extensions to do this open a file browser window then select "view->options->change folder and search options" next select the tab view then uncheck "hide extensions for known file types" I also like to set "Show hidden files, folders and drives" (but that has nothing to do with the tutorial).

If you have a keystore file skip this step. To make a keystore key using the "make.my.key.bat" (found in the root of the openbor android folder) first right click and edit the .bat file to modify the "alias_name" to your preferred alias then save and run. Complete all the details within the command prompt window keeping note of the passwords (they can be different but I like to keep them the same) and the alias. finally you will get a output file "my-key.jks" in the same directory keep this file safe as you will need it to sign your apks.

Next open the file "app/build.gradle" and modify the "MODIFY FOR CUSTOM APK" and the edit the fields to match your games details. to sign your app make a new text file named "keystore.properties" then open it with notepad (or your favourite text editor I recommend notepad++) and copy and paste this template:

storePassword=password
keyPassword=password
keyAlias=alias_name
storeFile=../my-key.jks

edit the fields to match your "my-key.jks" file and save. 2 things to note do not use quotes when completing these fields and second the default directory is the "android/app/" directory so in this example for "storeFile=../my-key.jks" your keystore file is located in the root android directory I recommend to copy your keystore file there to keep things simple. If you want to point to another file location it has to be relative to the apps directory you can not just copy the full path to your keystore file.

Copy your pak file to the folder "app\src\main\assets\bor.pak" and it should be less then 100mb if you want to publish to play store.

Now edit the "build.bat" file and make sure it is set to " cmd /k "gradlew.bat clean & gradlew.bat assembleRelease" " ignoring the outer quotes I used here. Run build.bat and if completed successfully your apk will be at "app/build/outputs/apk/release/app-release.apk" your can rename the apk if you want to and now your ready to upload your app.

Downloads

Oracle website (to download Java JDK you need to make a Oracle account)

Android command line tools (windows x64) (links to command line tools only is near the bottom of the page)

Android command line tools (windows x86)

Video Tutorial

 
Last edited:
I have updated this guide as I recently came across some issues re-setting up the android environment.  This should be much easier to follow now.
 
Is it a bug of Android build?
When switching OpenBoR to background then back to foreground the fps drops from full frame( 200 max) to 60-(vsync enabled after switch back?).
 
Well the debug fps counter is not accurate.  I switch in and out of openbor on the android and it still feels the same to me.

Real fps counter apps need you to do some extra setup though your pc while using usb debugging I did not bother with it.
 
I'm new to the forum, but I tested the engine recently today and constantly evaluating to base off for my game.

Good writeup!

I've added gradle build support for android now but not yet send the pull request, I'll do so soon.

I think this would add alternative for those that didn't have successful build with ant (I didn't neither, as checked Android removed build.xml from NDK, checked version 11 through latest no such file anymore).

Update: I made PR for gradle build at https://github.com/DCurrent/openbor/pull/135
 
Wow amazing thanks haxpor this was different from the method I was trying using cmakelist.txt but thanks for the help.  I tried to compile on windows and I got errors like this:

Code:
C:\openbor\openbor-android_gradle\engine\android-gradle\app\src\main\java\org\libsdl\app\SDL.java:1: error: illegal '.'
../../../../../../../../android/src/org/libsdl/app/SDL.java

How can I resolve this ?
 
Hey msmalik681 , actually that's a symlink file linking to actual existing one. In this case, it's real file in android/ directory. Would you please try using mingw's terminal instead of native command prompt on Windows? It would understand this symlink and path I think.

Note I saw this approach also used in SDL2 to build android project..

Please let me know if this works for you, thanks!

PS. I tested this on Linux.
 
Good to have you on board haxpor. Unfortunately if we can't compile on Windows that's a deal breaker. :(

I can't test your pull request right now, but I left word for Plombo and msmalik681 to take a look. If they give the all clear I'll be happy to approve and add you to the dev team.

Welcome to Chronocrash!

DC
 
Thank you DC and the team! This is lovely community indeed.

So much fun playing around and study how the engine works so far, very good engine that is really suitable for beatem'up style.
 
Here is a test build can anyone running android 6.0 or above please test this build.  You may have to restart openbor after giving permission to read and write to phone.

You may also have to disable play protect (from play store settings) to install this app.

Download: Test Build
 
Updated the tutorial in the first post to explain how to compile and sign apk's using the new android gradle build.  I have only just made a pull request so it should be in the master branch soon or you could use the version from my branch.
 
Great work guys , Im still on lg g3 with 4.4.2, any chance to make it compatible or should i strongly consider upgrading
 
I need to update the tutorial as haxpor did some nice work to make the build process more secure and with better cross platform support.

bWWd The latest master build should be working on your phone please test and get back to me.  My personal suggestion is the only time you need to upgrade your phone is if your not happy with the camera or internal storage.  You can update your phones software just search for your phones model on the XDA Forums you need to find a tutorial on how to unlock your boot loader then you can install a custom rom it can really give your phone a new life with more features, higher api, faster/smoother speeds, better more stable internet and much more.

bWWd here is the latest build please test on your phone. https://www.mediafire.com/file/audu3mdxyo38t2l/new.gradle-debug.apk/file

nsw25
As I explained in the tutorial you need the "Command line tools only" the download link is near the bottom of the page you linked.  I will try to use screen shots for the tutorial to make it easier to follow.  You need to sign up as a developer using the Google Play Console there will be a one off fee of about $20.

Any problems I am here to support you and everyone.

Edit: Just updated the tutorial in the first post will add pictures later.
 
Back
Top Bottom