After struggling with Travis, Gradle, and the Android SDK/NDK for a couple days, I’m on the verge of finally adding Android support to Minie. However, since I’ve never built an Android app with JMonkeyEngine, I’ll need help testing this feature.
Would someone experienced in making Android applications be willing to run some simple tests for me?
@tlf30 Thank you for volunteering. I imagine a quarantine in the Arctic would be mighty inconvenient!
Btw, is anyone available to test in the coming week? I’d hoped to include Android support in version 1.6, but if no one’s eager to try it, it can wait until 1.7 …
If you open the link above in the browser you can find available zip files under the “Command Line Tools only” part. Unzip it somewhere. After unzip you should see a folder named “tools”. Create a new folder somewhere on your disk and name it “android-sdk” and move the “tools” directory into it.
2- Clone this JME android Gradle template
Open local.properties and set the SDK path to the “android-sdk” directory you created in step 1.
In my case it looks like this: sdk.dir=/home/ali/opt/android-sdk
3- Update build.gradle in root project to be like this:
buildscript {
repositories {
jcenter()
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "http://palantir.bintray.com/releases" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.palantir.baseline:gradle-baseline-java:0.54.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:2.1.0'
}
}
apply plugin: 'com.android.application'
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
google()
maven { url "https://jitpack.io" }
}
ext {
jmerepo='org.jmonkeyengine'
jmeversion='3.3.0-beta1' //3.3.0-alpha1
}
}
android {
compileSdkVersion 23
// To suppress this warning, remove "buildToolsVersion" from your build.gradle file,
// as each version of the Android Gradle Plugin now has a default version of the build tools.
//buildToolsVersion "24.0.2"
defaultConfig {
applicationId 'com.mycompany.mygame'
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1"
}
lintOptions {
abortOnError false
}
//Uncomment to sign release APK
/*signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}*/
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//Uncomment to sign release APK
//signingConfig signingConfigs.release
}
}
}
dependencies {
compile (project(":game")) {
exclude module: "jme3-lwjgl"
exclude module: "jme3-desktop"
}
compile jmerepo + ':jme3-android:' + jmeversion
compile jmerepo + ':jme3-android-native:' + jmeversion
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
task copyAssets {
delete 'src/main/assets'
copy {
from 'game/src/main/resources/_assets'
into 'src/main/assets'
}
}
//task wrapper(type: Wrapper) {
//}
clean.dependsOn copyAssets
and set gradle wrapper to gradle-5.4.1.
Now you can buid app. After build success you can find generated apk under the build/outputs/apk/debug/ directory of your project.
After a successful build, Maven artifacts will be found in MinieLibrary/build/libs .
Any app that uses jme3-bullet and jme3-bullet-native-android should make a suitable test. Remove jme3-bullet and jm3-bullet-native-android, add the Minie-1.5.0 you built. (Not the one at JCenter!)
The supported Android ABIs are: armeabi-v7a, arm64-v8a, x86, and x86_64.
Things to look for:
Any unusual diagnostic messages while building Minie, building the app, or installing the app?
Is the native library loaded successfully during the JmeAndroidSystem initialization? Exceptions are ignored, so you may want to set a debugger breakpoint to be sure.
Is initJavaClasses() invoked the first time a PhysicsSpace or CollisionShape is created? If it is, there should be a message to standard output, saying Libbulletjme v5.5.3 initializing, but I don’t know what happens to standard output on an Android.
Does game physics work as expected?
physics debug visualization, if any
gravity
collision detection
contact forces
Any unusual diagnostic messages while running the app?
When you report back, please let me know what type of device you tested on, whether it was physical or emulated, and which ABI it used.
@Ali-RS: Thanks for the pointers. You assume I’d know what to do with the APK once I’d built it. I’ll try and see how far I get.
What is your default gradle version installed on your OS?
If it is >= 5.4.1 then I guess you should be fine to use it and you wont need to use wrapper.
My system’s default Gradle version is 4.4.1, but I use 6.3 for most of my projects.
Now that I’ve fixed the Gradle wrapper, I still can’t build anything due to missing licenses:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'JMEAndroidTemplate'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 23, Android SDK Build-Tools 24.0.2].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
Ah, yes, I think I needed to do the license agreements as well. I do not remember how I did it. I will do a google search now. Will get back to you soon.
Edit:
btw, @sgold have you updated build.gradle as said here?
I created 2 clones of the repo, one for testing and one for the PR. The PR repo did not have the build.gradle changes, and that’s the one that generated the licensing error messages I posted.
That class is provided by the Heart library. If you’re building with Gradle, there should be a dependency in Minie-1.5.0.pom that causes Heart-5.2.1 to be downloaded from JCenter, installed, and added to the build.