Hi.
I would like to port my Jogl2 application to Android tablet (Google Nexus 7). The first step I tried to do was creating a simple project, like jogl.test.apk. I made the following steps: 1. I did adb install gluegen-rt.apk adb install jogl.all-android.apk adb install jogl.android-launcher.apk I tried both the current version from the repository, the version from Google play, debug signed versions and I even tried signing the unsigned versions. This part works fine in all of the above cases when starting your jogl.test.apk tests. 2. I created a new Android project in Eclipse, inside package my.package. I added your classes NEWTRedSquareES2Activity and NEWTRedSquareES2ActivityLauncher to my package, and of course, the RedSquareES2 class. Inside the NEWTRedSquareES2ActivityLauncher, I changed the Intent to: final Intent intent = new Intent(this, my.package.NEWTRedSquareES2Activity.class); - so it doesn't call your classes from jogl.test.apk. 3. At this point, I got many errors so I included the following external jars to java build path, just to make Eclipse happy: gluegen-rt-android.jar gluegen-rt-natives-android-armv6.jar jogl-all-android.jar jogl-all-natives-android-armv6.jar 4. My manifest file looks like this: http://pastebin.com/H957x3bi Problem: When I try to launch my project on the tablet, I get the following error: [2012-11-20 15:25:04 - Jogl2CES2013_Android] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2012-11-20 15:25:04 - Jogl2CES2013_Android] Please check logcat output for more details. [2012-11-20 15:25:04 - Jogl2CES2013_Android] Launch canceled! It seems that my project can't see the packages installed on my tablet. Could I get any help on that matter? Thanks, Alan |
Administrator
|
I think that the native libraries are not found. I'm sorry, there is a lack of tutorial about JOGL & Android.
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by asambol
On 11/20/2012 04:06 PM, asambol [via jogamp] wrote:
> Hi. > > I would like to port my Jogl2 application to Android tablet (Google Nexus 7). > The first step I tried to do was creating a simple project, like jogl.test.apk. > > I made the following steps: > > 1. I did > adb install gluegen-rt.apk > adb install jogl.all-android.apk > adb install jogl.android-launcher.apk > > I tried both the current version from the repository, the version from Google > play, debug signed versions and I even tried signing the unsigned versions. > This part works fine in all of the above cases when starting your > jogl.test.apk tests. > > 2. I created a new Android project in Eclipse, inside package my.package. I > added your classes NEWTRedSquareES2Activity and > NEWTRedSquareES2ActivityLauncher to my package, and of course, the > RedSquareES2 class. > So it still reads: 'class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLauncher' ? > Inside the NEWTRedSquareES2ActivityLauncher, I changed the Intent to: > final Intent intent = new Intent(this, > my.package.NEWTRedSquareES2Activity.class); - so it doesn't call your classes > from jogl.test.apk. W/o using BaseActivityLauncher's Intent and hence it's DataSet, there will be no proper communication to our activity launcher code. Note that BaseActivityLauncher is part of the JAR file containing the demo/test itself and hence need to be copied to your workspace as well! Here is an overview of our activity launcher mechanism: <http://forum.jogamp.org/Migrate-a-Java-application-using-Jogl-to-Android-tablet-td3732586.html#a3738415> +++ Of course, you can simply drop all of this and create one big APK from our JAR files _and_ your application JAR file, where your activity will be called directly. > > 3. At this point, I got many errors so I included the following external jars > to java build path, just to make Eclipse happy: > gluegen-rt-android.jar > gluegen-rt-natives-android-armv6.jar > jogl-all-android.jar > jogl-all-natives-android-armv6.jar > > 4. My manifest file looks like this: http://pastebin.com/H957x3bi Can you make that '<activity android:name=".NEWTRedSquareES2ActivityLauncher"' explicit like in ours: <http://jogamp.org/git/?p=jogl.git;a=blob;f=make/resources/android/AndroidManifest-test.xml;hb=HEAD> but I guess that is not the issue, but the Intent's data .. see above. ~Sven signature.asc (909 bytes) Download Attachment |
>> 2. I created a new Android project in Eclipse, inside package my.package. I
>> added your classes NEWTRedSquareES2Activity and >> NEWTRedSquareES2ActivityLauncher to my package, and of course, the >> RedSquareES2 class. > > So it still reads: 'class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLauncher' ? Nope, the original GearsES2 launcher doesn't extend BaseActivityLauncher either, but it still works from your apk: http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java;h=96299e873651dce5dc2b99f7b6c5f94036ece402;hb=HEAD >> 4. My manifest file looks like this: http://pastebin.com/H957x3bi > > Can you make that > '<activity android:name=".NEWTRedSquareES2ActivityLauncher"' > > explicit like in ours: > > <http://jogamp.org/git/?p=jogl.git;a=blob;f=make/resources/android/AndroidManifest-test.xml;hb=HEAD> > > but I guess that is not the issue, but the Intent's data .. see above. Tried that, no effect. |
Administrator
|
In reply to this post by asambol
On 11/21/2012 08:31 AM, Sven Gothel wrote:
> > Here is an overview of our activity launcher mechanism: > <http://forum.jogamp.org/Migrate-a-Java-application-using-Jogl-to-Android-tablet-td3732586.html#a3738415> > <http://jogamp.org/git/?p=gluegen.git;a=commit;h=0cfc7847c58b51c9a26b50d905b592d1fc4c8578> signature.asc (909 bytes) Download Attachment |
Administrator
|
In reply to this post by asambol
On 11/21/2012 09:06 AM, asambol [via jogamp] wrote:
>>> 2. I created a new Android project in Eclipse, inside package my.package. I >>> added your classes NEWTRedSquareES2Activity and >>> NEWTRedSquareES2ActivityLauncher to my package, and of course, the >>> RedSquareES2 class. >> >> So it still reads: 'class NEWTGearsES2ActivityLauncher extends > LauncherUtil.BaseActivityLauncher' ? > > Nope, the original GearsES2 launcher doesn't extend BaseActivityLauncher > either, but it still works from your apk: > http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java;h=96299e873651dce5dc2b99f7b6c5f94036ece402;hb=HEAD which will spawn-off our launcher while passing the demo activity. See another updated description: <http://jogamp.org/git/?p=gluegen.git;a=commit;h=0cfc7847c58b51c9a26b50d905b592d1fc4c8578> If you don't use the launcher method, you can start the demo activity right away - ofc. Note that to do so, you have to create one big APK archive containing the Android gluegen and jogl JARs, while maintaining the assets folders w/ native libraries! To do so - you can either use our gluegen ant build macro for AAPT, or do your own recipe. Please have a look at our gluegen-rt and jogl APK files and how assets [w/ native libs] are being laid out. ~Sven signature.asc (909 bytes) Download Attachment |
This post was updated on .
In reply to this post by Sven Gothel
Update.
I tried with the NEWTGearsES2ActivityLauncher, which does extend LauncherUtil.BaseActivityLauncher, and it works! Thanks again for your help. So, if anyone ever wants to use Jogl2 in an Eclipse environment for Android, here is a short tutorial: 1. Install via adb or Google play the following packages (no need for the test package). adb install gluegen-rt.apk adb install jogl.all-android.apk adb install jogl.android-launcher.apk 2. Create a new Android project in Eclipse, inside package my.package. Add the following classes (link) to your package: LauncherUtil.java NEWTGearsES2Activity.java - feel free to change name to YourActivity - change GearsES2 demo = new GearsES2(-1) to RedSquareES2 demo = new RedSquareES2(-1) or to your GLEventListener class NEWTGearsES2ActivityLauncher.java - feel free to change name to YourActivityLauncher RedSquareES2.java (from here) a) change String demo to "my.package.NEWTGearsES2Activity" (or YourActivity) b) change usr_pkgs to "my.package" 3. In java build path for that project, add: gluegen-rt-android.jar jogl-all-android.jar (no need for native jars) 4. Create a folder named "shader" inside your "assets" folder, put RedSquareShader.fp and RedSquareShader.vp inside. (link) - here, I had a problem linking those shaders on my device, needed to add precision qualifiers on the beginning, no big deal - it worked after that 5. Your manifest should look like this: http://pastebin.com/R99iJ6Wc After that, press launch on device and it should work. The weird part here is that I had to remove the "<uses-library>" tags from manifest, otherwise it gave the above INSTALL_FAILED_MISSING_SHARED_LIBRARY error. Any thoughts on that? |
Administrator
|
Thanks asambol.
Julien Gouesse | Personal blog | Website
|
In reply to this post by asambol
The links in the above guide above were updated to HEAD revisions instead of the specific revision in the past. Otherwise it wouldn't work with latest apk's.
It's important to update LauncherUtil.java, YourActivityLauncher.java and YourActivity.java in your projects every time you update the apk's on your device. |
In reply to this post by asambol
Hello all,
seems like this thread is quite old, but I will still post my issue as a reply here because it is best related to this post. Yes, I am trying to run basic jogamp example (gears or redsquare) on android as mentioned in this thread, but I had to incorporate some ugly workarounds and tweaks to get it working. So first some facts: - using JOGL version 2.3.2 latest download. - using real device with Android 5.1 Lollipop, 7" Lenovo Phablet. - using latest 24.0.1 android build tools and have all sdk platforms installed. Target SDK is same as in examples. - 64 bit openJDK of version 1.8.0_92 - installed all mentioned apk's via adb, almost all examples from test package WORK well. - created the same android projects in several IDEs, added needed jar libraries from SAME jogamp package to build path. - tweaked Manifest to respect my class names, either attached a copy of LauncherUtil or used directly those from jogl-test package. - tweaked launcher class parameters to run activity from my package, added shaders as assets (when needed). - built without problems, until now all OK. - penta-checked everything.... Debug tries: - I can verify that "<uses-library>" tags should be removed, otherwise INSTALL_FAILED_MISSING_SHARED_LIBRARY really occurs. - After manifest update came the final problem which I was not able to solve in "smooth" manner. Here is simple copy-paste from logcat (http://pastebin.com/raw/N7apxs3P), real errors are almost at the bottom, I hope it will help. Those errors varied a bit depending on used GLEventListener and/or individual class changes etc. but still in the same pipeline. - After some time spent playing with this, I found out, that my simple program runs with imported LauncherUtil class removed while providing the original from jogl-test-android.jar package. I CHECKED several times and imported that LauncherUtil class code from the SAME downloaded archive. - So, what I meant by non-smooth solution, I digged a bit more in this problem, and began to reduce contents of jogl-test-android.jar package manually (it is quite large on its own because of embedded fonts and other test cases). So I came to final working solution, all packages/classes entries removed, only contents of com.jogamp.opengl.test.android and com.jogamp.opengl.test.junit.util classpaths were left untouched. Should I try and remove entries from those two left classpaths trying to leave there possibly only LauncherUtil and its internal classes, error was back. Here I stopped with my experimenting, because this is offcourse not a good way to go, yet jogl-test-android.jar is now < 100Kb and things work well. Seems to me like classes from this test package are imported somewhere by gluegen or jogl-all-android packages. - Unfortunately I cannot debug my activity more properly, because jogamp launcher takes care of launching my Activity,... I will gladly provide any further informations necesarry on your request and hope that someone of you with better insight into JOGL internals will grasp and catch up root cause of this problem. Have a nice summer days... Jan |
Administrator
|
Well, in android manifest file, I replied to asambol's post because I tried to follow his steps in complete android project setup, jogl demo recreation to be precise. It is actually the last line of his post...
J. |
In reply to this post by zeno
Hello all,
I played a bit more with these demos on android and came to solution, that is simple, debuggable and works well. LauncherUtil is bypassed so that jogl-test-android.jar and its tweaking is no longer needed. So, following steps were enough for me to get it working: 1) Referenced libraries (jogl-all-android.jar, gluegen-rt-android.jar) put into android project ./libs/ folder. 2) Native libraries (libgluegen-rt.so, libjogl_mobile.so and libnewt.so) put into ./libs/armeabi/ subfolder (same for all other necessary architectures respectively). 3) Main activity extends NewtBaseActivity, configured directly as MAIN action and LAUNCHER category in project manifest. 4) Jogamp apk's are no longer needed at all. If you want to use demo GL event listeners, just add jogl-test-android.jar reference to access its demo classes (RedSquareES2 etc.). But beware, this way demo shader codes must be put to your project ./assets/shader folder because we do not use LauncherUtil and gluegen's custom dex/asset/classloader utils which originally resolves and loads these resources. Application is also properly debuggable this way as main activity is launched directly. Have a nice day. Jan |
Administrator
|
Thank you for sharing your findings. Your solution is very interesting for those who'd like to avoid bundling Jogamp APKs with their stuffs.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |