Login  Register

Re: Gluegen apk won't install on Android 6 (Marshmallow)

Posted by philjord on Feb 11, 2016; 8:47pm
URL: https://forum.jogamp.org/Gluegen-apk-won-t-install-on-Android-6-Marshmallow-tp4036114p4036185.html

In case anyone else strikes this certificates issue with gluegen-rt-android-armv6.apk not installing on Android 6 here is how I worked around it in order to get the Jogl Version Info to show up.

What I describe below is NOT how to get things done properly, it fixes nothing and sheds no light on the signing issue described above, it is just an option if you are stuck (like I was).

Here is how things are done properly, along with explanation
https://jogamp.org/wiki/index.php/Maven_And_Android

Below is just my ramblings...

Install Android Studio (this takes a while, update everything to the newest)
(Note Android Studio uses Gradle not Maven)

I decided to start from a base of the example jp4da project (here) under maven/jp4da, in theory if you know Android coding well a new project would be just as quick.

I put the jp4da project in a temp folder and in Android Studio used "New->Import Project" on it to get it in.

I changed gradle.build and androidManifest.xml to use minSdkVersion 23 and targetSdkVersion 23 (23 is Android 6)

I put the Example.Java file from core into this project next to MainActivity.Java (this is simpler than a two project solution)

For the life of me I could not get gluegen to load the *.so files, I couldn't even wrestle android studio to include the *.so files in the generated apk.

I found and followed these instructions:
http://stackoverflow.com/questions/16683775/include-so-library-in-apk-in-android-studio/17131418#17131418

Note that below I'm using the armv6 version of files you may need to use aarch64 depending on your target platform (if you do it will change the folder name to lib/arm64-v8a)

I extracted jogamp-all-platforms (here) into a temp folder.

I took libgluegen-rt.so from gluegen-rt-android-armv6.apk (found in the jogamp-all-platforms/apk folder)
and libjogl_mobile.so and libnewt.so from jogl-all-android-armv6.apk

I put these in a jar file with the correct structure (lib/armeabi), as described in the stackoverflow link above.

I put that jar with jogl-all-android.jar and gluegen-rt-android.jar all into libs folder and in Android Studio I right clicked "add library" on each

I updated gradle.build with "compile fileTree(include: '*.jar', dir: 'libs')"

Then I fixed up the use of System.err to Log.e and e.getPressure() > 2f to e.getPressure(true) >0.4f in MainActivity.java and Example.java

Then I ran it and got a lovely blue screen, which meant success.

Finally I commented away the onCreate method of MainActivity and made the class declaration this:
public class MainActivity extends NewtVersionActivity {//NewtBaseActivity {

Then I ran it and got the Jogl Version Info screen!

For reference my AndroidManaifest.xml looks like this

<?xml version="1.0" encoding="utf-8"?>
<manifest
  xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.io7m.examples.jp4da"
  android:versionCode="1"
  android:versionName="1.0">
    <uses-sdk android:targetSdkVersion="23" android:minSdkVersion="23"/>
  <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
    <activity android:name="MainActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
</manifest>

and my Gradle.build looks like this

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.io7m.examples.jp4da"
        minSdkVersion 23
        targetSdkVersion 23
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile files('libs/jogl-all-android.jar')
    compile files('libs/gluegen-rt-android.jar')
    compile fileTree(include: '*.jar', dir: 'libs')
    compile files('libs/jogl-test-android.jar')
}