Compiling the android demo in the 1.6 release

edited January 2015 in Help request

I've been trying to compile the orx android demo in the 1.6 release on my Ubuntu 14.04 64 bit setup;

After installing Android SDK and NDK, I've went to the demo directory at /dev-android/demo/android, modified the app/build.gradle to use my sdk version and issued ./gradlew build. The gradle build has reported success and I could find the .apk's under /dev-android/demo/android/app/build/outputs/apk.

The problem is that the generated apk's are faulty. When I try to run them on my Samsung Galaxy Note 10.1 (ver. 4.1.2), they crash immediately.

While trying to figure out what's going on, I've discovered that the jni libs are nowhere to be found in the .apk and the source are never compiled anyway.

Trying to fix this, I've moved the app/src/jni folder to app/src/main/jni (where gradle seems to look for jni sources). This time, it tried to compile the sources, but the compilation failed, since this way, gradle seems to completely ignore the in the jni folder, so the orx library doesn't get included in the compilation nor the linking.

When I go to the app/src folder and issue ndk-build, it actually successfully compiles the jni sources and creates all the .so files. I guess I could just copy these into the .apk manually, or possibly even modify the gradle build script to do that for me, but thought maybe there is an easier way.

Am I missing some README somewhere that explains the proper way to compile the demo? Or maybe the sources work on OSX or Windows out of the box?



  • edited January 2015
    Hi enobayram, I haven't quite finished the new documentation to cover the new builds for the android demo. I've PM'ed some scrappy notes to you.

    I'll get this finished up hopefully on the weekend.
  • edited January 2015

    you need first to compile the jni before deploying on the device.
    issue an ndk-build in /app/src, it will create an /app/src/libs folder with the .so files.

    then ./gradlew installDebug should install the apk on your connected device

    if you want to check the .apk, issue and ./gradelw assembleDebug
    the apk is in /app/build/outputs/apk
  • edited January 2015
    Oh, that explans the mysterious jniLibs.srcDirs = line, thanks.

    Would you like me to add the ndk-build bit to the gradle script and create a pull request?
Sign In or Register to comment.