[TIMOB-24176] Hyperloop: Android - JNI libs should be included in APK
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-12-12T21:21:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Hyperloop 2.0.1 |
Components | Android, Hyperloop |
Labels | android, hyperloop |
Reporter | Rodolfo Perottoni |
Assignee | Gary Mathews |
Created | 2016-11-25T00:18:52.000+0000 |
Updated | 2017-03-24T14:53:41.000+0000 |
Description
Some Android libs use the Java Native interface (JNI). I've noticed that Hyperloop doesn't copy these external libs to the final APK. They're usually located inside .AAR's *lib* folder.
Take GoogleVR SDK, for example.
!Screen Shot 2016-11-25 at 10.14.12 am.png|thumbnail!
You can see that these libs are inside the *build* folder. All good!
Problem is, they're not copied to the final APK:
!Screen Shot 2016-11-25 at 10.16.02 am.png|thumbnail!
I can provide an example project via e-mail.
This exception will be thrown:
[ERROR] HyperloopProxy: (main) [366,366] Exception during instantiation of class 'com.google.vr.sdk.widgets.pano.VrPanoramaView'
[ERROR] HyperloopProxy: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.loopmodules.googlevr-1/base.apk"],nativeLibraryDirectories=[/data/app/com.loopmodules.googlevr-1/lib/arm, /data/app/com.loopmodules.googlevr-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libpanorenderer.so"
[ERROR] HyperloopProxy: at java.lang.Runtime.loadLibrary(Runtime.java:379)
[ERROR] HyperloopProxy: at java.lang.System.loadLibrary(System.java:1086)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.pano.VrPanoramaRenderer.<init>(VrPanoramaRenderer.java:28)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.pano.VrPanoramaView.createRenderer(VrPanoramaView.java:101)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.pano.VrPanoramaView.createRenderer(VrPanoramaView.java:14)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.common.VrWidgetView.initializeRenderingView(VrWidgetView.java:323)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.common.VrWidgetView.init(VrWidgetView.java:232)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.common.VrWidgetView.<init>(VrWidgetView.java:185)
[ERROR] HyperloopProxy: at com.google.vr.sdk.widgets.pano.VrPanoramaView.<init>(VrPanoramaView.java:94)
[ERROR] HyperloopProxy: at java.lang.reflect.Constructor.newInstance(Native Method)
[ERROR] HyperloopProxy: at hyperloop.ClassProxy.newInstance(ClassProxy.java:89)
[ERROR] HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
[ERROR] HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:189)
[ERROR] HyperloopProxy: at org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:241)
[ERROR] HyperloopProxy: at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:102)
[ERROR] HyperloopProxy: at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:150)
[ERROR] HyperloopProxy: at org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:107)
[ERROR] HyperloopProxy: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:673)
[ERROR] HyperloopProxy: at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:143)
[ERROR] HyperloopProxy: at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:96)
[ERROR] HyperloopProxy: at android.app.Activity.performCreate(Activity.java:6372)
[ERROR] HyperloopProxy: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
[ERROR] HyperloopProxy: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)
[ERROR] HyperloopProxy: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
[ERROR] HyperloopProxy: at android.app.ActivityThread.access$900(ActivityThread.java:168)
[ERROR] HyperloopProxy: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
[ERROR] HyperloopProxy: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] HyperloopProxy: at android.os.Looper.loop(Looper.java:150)
[ERROR] HyperloopProxy: at android.app.ActivityThread.main(ActivityThread.java:5665)
[ERROR] HyperloopProxy: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] HyperloopProxy: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
[ERROR] HyperloopProxy: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2016-11-25 at 10.14.12 am.png | 2016-11-25T00:14:25.000+0000 | 44290 |
Screen Shot 2016-11-25 at 10.16.02 am.png | 2016-11-25T00:16:14.000+0000 | 45323 |
Hello, Please provide a sample project for us to test the issue. Thanks.
Like I said, I can provide it by email. Can I have yours?
Hey [~rdperottoni], I wondered why it doesn't work on 2.0.0, because it should be fixed in TIMOB-23945 or it's some other use-case for this one. Thx! *EDIT*: So if I get it correctly, the linked ticket copies it to the build directory, but not to the APK? We didn't do much more than that, I thought the Android build would take care of the rest. *EDIT 2*: Looking at [this gist](https://gist.github.com/khernyo/4226923#file-build-gradle-L31-L34), we could do the same on our JS side.
Hey @Hans Knoechel. Yes, that's exactly it. It gets copied to the build folder but not to the APK.
[~rdperottoni] This has been fixed, could you make sure you are using
Hyperloop 2.0.0
where this issue has been addressed?[~gmathews] I tested it, it's copies to the build dir but not the generated APK.
master: https://github.com/appcelerator/hyperloop.next/pull/108 2_0_X: https://github.com/appcelerator/hyperloop.next/pull/109
[~gmathews] Have you tested the changes already? I think [~cwilliams] wrote
libs
instead oflib
for a reason, so I'd like to clear that before merging. Thx!NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.3 Appc CLI: 6.1.0 Appc CLI NPM: 4.2.8 Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2.1 Hyperloop 2.0.1 Titanium SDK version: 6.0.3.v20170320120738 Verified the fix is present in hyperloop 2.0.1. I packaged an Android app that uses the JNI libs. I then checked the apk file and verified that the appropriate libraries were present in that file.
[~mrahman], i can't reproduce the error with the steps you provided, can you please double check your test code? The app successfully starts and shows a black screen with no errors reported. Your error message also indicates an error that is not related to this ticket. To keep things clear and not clutter this ticket please open another one if the issue persists, thanks!