[TIMOB-24800] Hyperloop: Android - aar not working in 2.1.0 anymore, it can't find R$style
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-06-22T01:57:11.000+0000 |
Affected Version/s | Hyperloop 2.1.0 |
Fix Version/s | Release 6.1.1 |
Components | Hyperloop |
Labels | aar, android, hyperloop |
Reporter | Reymundo López |
Assignee | Jan Vennemann |
Created | 2017-06-08T20:35:17.000+0000 |
Updated | 2017-06-23T22:54:51.000+0000 |
Description
While trying to run the same aar that was working fine with hyperloop 1.2.8, now using 2.1.0 it crashes showing the following error:
[ERROR] HyperloopProxy: (main) [1369699,1497486] Exception thrown during invocation of method: public void io.ridetap.RideTap.showRideTap(), args: []
[ERROR] HyperloopProxy: java.lang.NoClassDefFoundError: Failed resolution of: Lio/ridetap/R$style;
[ERROR] HyperloopProxy: at io.ridetap.internal.ui.cards.CardListDialog.<init>(CardListDialog.java:74)
[ERROR] HyperloopProxy: at io.ridetap.internal.ui.cards.RideTapCardDialog.<init>(RideTapCardDialog.java:44)
[ERROR] HyperloopProxy: at io.ridetap.RideTap.showRidesPager(RideTap.java:843)
[ERROR] HyperloopProxy: at io.ridetap.RideTap.showRideTap(RideTap.java:213)
[ERROR] HyperloopProxy: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] HyperloopProxy: at hyperloop.BaseProxy.invokeMethod(BaseProxy.java:145)
[ERROR] HyperloopProxy: at hyperloop.InstanceProxy.invokeMethod(InstanceProxy.java:183)
[ERROR] HyperloopProxy: at hyperloop.BaseProxy.callNativeFunction(BaseProxy.java:127)
[ERROR] HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
[ERROR] HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)
[ERROR] HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)
[ERROR] HyperloopProxy: at hyperloop.HyperloopInvocationHandler.invoke(HyperloopInvocationHandler.java:58)
[ERROR] HyperloopProxy: at java.lang.reflect.Proxy.invoke(Proxy.java:813)
[ERROR] HyperloopProxy: at $Proxy6.run(Unknown Source)
[ERROR] HyperloopProxy: at android.os.Handler.handleCallback(Handler.java:751)
[ERROR] HyperloopProxy: at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] HyperloopProxy: at android.os.Looper.loop(Looper.java:154)
[ERROR] HyperloopProxy: at android.app.ActivityThread.main(ActivityThread.java:6119)
[ERROR] HyperloopProxy: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] HyperloopProxy: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
[ERROR] HyperloopProxy: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
[ERROR] HyperloopProxy: Caused by: java.lang.ClassNotFoundException: Didn't find class "io.ridetap.R$style" on path: DexPathList[[zip file "/data/app/com.moovel.riderapp.via.shareddev-2/base.apk"],nativeLibraryDirectories=[/data/app/com.moovel.riderapp.via.shareddev-2/lib/x86, /system/fake-libs, /data/app/com.moovel.riderapp.via.shareddev-2/base.apk!/lib/x86, /system/lib, /vendor/lib]]
[ERROR] HyperloopProxy: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[ERROR] HyperloopProxy: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
[ERROR] HyperloopProxy: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
[ERROR] HyperloopProxy: ... 21 more
Inside of the aar, is included the asset that the error is trying to find, but when the apk is built, it can't find it in the internals of the apk.
Same code works fine using hyperloop 1.2.8 and Titanium SDK 5.5.1, we are trying to upgrade everything to the latest version and we are blocked by this.
Attachments
File | Date | Size |
---|---|---|
styles-debug.aar | 2017-06-20T12:11:40.000+0000 | 2932 |
Hey there, did you also test with Hyperloop 2.1.1 already?
Well this is weird, I'm having both issues, the one related to TIMOB-24275 and the one not finding
R$style
, tried with a new project only with the aar and the jars needed and I got theR$style
error.[~reymundolopez], it's hard to reproduce without any example code. Could you provide a minimal working example to reproduce the behavior you are seeing? I attached a small testing .aar which just reads out something from
R.style
and prints it to console. Can you check with that too? Just drop into your project as usual and use like this:It should print the following log message:
Obtained style attribute textColor from @style/CodeFont: ff00ff00
. Also the package's R.java is being generated tobuild/android/gen/com/example/styles/R.java
[~jvennemann] yes I will send the example to you appcelerator email account, since the aar is proprietary I can't share it to the world yet.
This was caused by the Alloy and aar transform hooks being run in the wrong order. The aar transform hook only checks
platform/android
for .aar files. Alloy will copy the contents ofapp/platform/android
there, so the order in which the hooks are executed is important because they both hook intobuild.pre.compile
. I slightly lowered the aar transform hook priority to make sure it runs after Alloy and all .aar files are in the expected folder for the aar transform hook. PR (master): https://github.com/appcelerator/titanium_mobile/pull/9167 PR (2_1_X): https://github.com/appcelerator/titanium_mobile/pull/9168Passed FR: Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.2 Appc CLI NPM: 4.2.9 Titanium SDK version: local built with PR/9168 Appcelerator Studio, build: 4.9.0.201705302345 Xcode 8.3.2 Hyperloop 2.1.1 I followed the testing instructions per Jan's comments above and confirmed that the app builds and runs with no errors. Additionally, the expected message on the console was also seen. FR passed.
[~amukherjee] did you tried the example I provide to [~jvennemann]?, the example attached here is not a good example of the issue we are having, since is already working with previous versions of hyperloop/Ti SDK.
[~reymundolopez] I just contacted [~jvennemann] and got your example from him. I don't have a setup at home, so I'll test it when I get into the office later this morning.
Changes were verified to be in: 6.1.1.v20170622183547 6.2.0.v20170622105148