[TIMOB-16598] Android: Application may crash referencing Ti.Geolocation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.2.1 |
Fix Version/s | n/a |
Components | Android |
Labels | android, geolocation |
Reporter | Chris Apers |
Assignee | Unknown |
Created | 2014-03-09T18:09:56.000+0000 |
Updated | 2018-02-28T20:04:23.000+0000 |
Description
If you reference Ti.Geolocation somewhere in your code BUT don't use any of the methods/properties, the geolocation.res.zip will not be included in the build and the app may hang on splash screen and return the following exception in the trace:
[ERROR] : JNIUtil: Couldn't find Java class: ti/modules/titanium/geolocation/GeolocationModule
[WARN] : W/System.err: java.lang.NoClassDefFoundError: ti/modules/titanium/geolocation/GeolocationModule
[WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
[WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:159)
[WARN] : W/System.err: at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:289)
[WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:185)
[WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] : W/System.err: at android.os.Looper.loop(Looper.java:137)
[WARN] : W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[WARN] : W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "ti.modules.titanium.geolocation.GeolocationModule" on path: /data/app/com.drizly.DrilzyDev6-1.apk
[WARN] : W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
[WARN] : W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
[WARN] : W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
[WARN] : W/System.err: ... 7 more
[INFO] : libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 9824 (KrollRuntimeThr)
Easy way to reproduce
Here the compiler will not detect usage of forwardGeocoder() and the lib will not be included!
Moving this ticket to engineering as I can reproduce this issue easily with the provided test case. Same test case works fine with iOS platform.
Stack trace: [WARN] : W/System.err: java.lang.NoClassDefFoundError: ti/modules/titanium/geolocation/GeolocationModule [ERROR] : JNIUtil: Couldn't find Java class: ti/modules/titanium/geolocation/GeolocationModule [WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) [WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:159) [WARN] : W/System.err: at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:289) [WARN] : W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:185) [WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) [WARN] : W/System.err: at android.os.Looper.loop(Looper.java:137) [WARN] : W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [WARN] : W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "ti.modules.titanium.geolocation.GeolocationModule" on path: /data/app/com.appcelerator.testproject-1.apk [WARN] : W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) [WARN] : W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:501) [WARN] : W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:461) [WARN] : W/System.err: ... 7 more