[TIMOB-26606] Hyperloop: Failed to run dexer with Samsung Pass library
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Done |
Resolution Date | 2019-04-08T21:01:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | android, engTriage, hyperloop |
Reporter | Michael Gangolf |
Assignee | Eric Merriman |
Created | 2018-09-03T09:55:36.000+0000 |
Updated | 2019-04-08T21:01:46.000+0000 |
Description
I have to update an old Ti 6.0.1 app to Ti 7.3.1. It was using hyperloop on Android already to load an external (closed source) banking module. When I compile the app now (all modules are up to date and iOS compiles fine) I'll end up with this error:
{noformat}
[ERROR] Failed to run dexer:
[ERROR]
[ERROR] warning: Ignoring InnerClasses attribute for an anonymous inner class
[ERROR] (com.samsung.android.sdk.pass.a) that doesn't come with an
[ERROR] associated EnclosingMethod attribute. This class was probably produced by a
[ERROR] compiler that did not target the modern .class file format. The recommended
[ERROR] solution is to recompile the class from source, using an up-to-date compiler
[ERROR] and without specifying any "-target" type options. The consequence of ignoring
[ERROR] this warning is that reflective operations on this class will incorrectly
[ERROR] indicate that it is *not* an inner class.
[ERROR] warning: Ignoring InnerClasses attribute for an anonymous inner class
[ERROR] (com.samsung.android.sdk.pass.c) that doesn't come with an
[ERROR] associated EnclosingMethod attribute. This class was probably produced by a
[ERROR] compiler that did not target the modern .class file format. The recommended
[ERROR] solution is to recompile the class from source, using an up-to-date compiler
[ERROR] and without specifying any "-target" type options. The consequence of ignoring
[ERROR] this warning is that reflective operations on this class will incorrectly
[ERROR] indicate that it is *not* an inner class.
[ERROR] warning: Ignoring InnerClasses attribute for an anonymous inner class
[ERROR] (com.samsung.android.sdk.pass.b) that doesn't come with an
[ERROR] associated EnclosingMethod attribute. This class was probably produced by a
[ERROR] compiler that did not target the modern .class file format. The recommended
[ERROR] solution is to recompile the class from source, using an up-to-date compiler
[ERROR] and without specifying any "-target" type options. The consequence of ignoring
[ERROR] this warning is that reflective operations on this class will incorrectly
[ERROR] indicate that it is *not* an inner class.
[ERROR] warning: Ignoring InnerClasses attribute for an anonymous inner class
[ERROR] (com.samsung.android.sdk.pass.d) that doesn't come with an
[ERROR] associated EnclosingMethod attribute. This class was probably produced by a
[ERROR] compiler that did not target the modern .class file format. The recommended
[ERROR] solution is to recompile the class from source, using an up-to-date compiler
[ERROR] and without specifying any "-target" type options. The consequence of ignoring
[ERROR] this warning is that reflective operations on this class will incorrectly
[ERROR] indicate that it is *not* an inner class.
[ERROR] warning: Ignoring InnerClasses attribute for an anonymous inner class
[ERROR] (com.samsung.android.sdk.pass.e) that doesn't come with an
[ERROR] associated EnclosingMethod attribute. This class was probably produced by a
[ERROR] compiler that did not target the modern .class file format. The recommended
[ERROR] solution is to recompile the class from source, using an up-to-date compiler
[ERROR] and without specifying any "-target" type options. The consequence of ignoring
[ERROR] this warning is that reflective operations on this class will incorrectly
[ERROR] indicate that it is *not* an inner class.
[ERROR]
[ERROR] UNEXPECTED TOP-LEVEL EXCEPTION:
[ERROR] java.lang.RuntimeException: Unexpected exception in dex writer thread
[ERROR] at com.android.dx.command.dexer.Main.runMultiDex(Main.java:399)
[ERROR] at com.android.dx.command.dexer.Main.runDx(Main.java:289)
[ERROR] at com.android.dx.command.dexer.Main.main(Main.java:247)
[ERROR] at com.android.dx.command.Main.main(Main.java:94)
{noformat}
Since it's compiling fine with the old hyperloop in 6.0.1 I guess that it wasn't even used there? Or did something changed in the way classes are handled now?
If I remove the Samsung pass.jar inside the AAR it stops with just
{noformat}
[ERROR] Failed to run dexer:
[ERROR]
[ERROR] UNEXPECTED TOP-LEVEL EXCEPTION:
[ERROR] java.lang.RuntimeException: Unexpected exception in dex writer thread
[ERROR] at com.android.dx.command.dexer.Main.runMultiDex(Main.java:399)
[ERROR] at com.android.dx.command.dexer.Main.runDx(Main.java:289)
[ERROR] at com.android.dx.command.dexer.Main.main(Main.java:247)
[ERROR] at com.android.dx.command.Main.main(Main.java:94)
{noformat}
I can contact the company if there is anything that needs to be changed inside the Android module
Hello, Thanks for sharing with us. What's your java version? Please provide a full sample testcode that regenerates the issue. Better to provide a sample app as an attachment here.
"java --version" is "1.8.0_161", OSX 10.13.6, NDK 12.1.2977051. Sample code won't help since it's a compiling error :) Without hyperloop the app runs fine. I can ask the client if its possible to share the aar
[~michael], what other JARs or AARs are you including in your project other than Samsung's "pass.jar"? I ask because this sounds like a library version conflict. Possibly an older (or newer) Google support jar you might be including that's overwriting one that Titanium uses.
[~jquick], the following modules are included in Android:
The aar itself includes bouncycastle and the samsung pass/sdk. The original (old 6.0.1) project included android-support-v4, v7-appcompat, design-23.1.1 and sliding-layer in the app/platform/android/ folder. I removed those support libraries already without any luck. I've contacted the client to check if I can send you the aar file!
I've send you a slack message with the module download!
[~michael], thanks for sending me the module. I was able to reproduce it. I've confirmed that the error is caused by library version conflicts. You'll need to remove the following libraries. It'll compile and run successfully if you do: * android-support-v4.jar * android-support-v7-appcompat.jar * design-23.1.1.aar * google-play-services-base.jar * google-play-services.gcm.jar * google-play-services.iid.jar This is because the above libraries are support and design libraries are already included in Titanium here... https://github.com/appcelerator/titanium_mobile/tree/master/android/modules/appcompat/lib https://github.com/appcelerator/titanium_mobile/tree/master/android/modules/design/lib And our "ti.playservices" module already includes the above mentioned Google Play Services libraries... https://github.com/appcelerator-modules/ti.playservices/tree/master/android/lib Note that you don't normally include the "ti.playservices" module directly. It's normally included indirectly by a module that references it as a dependency. For example, our "cloudpush" module which does push notifications for Android references "ti.playservices" in its "timodule.xml" here... https://github.com/appcelerator-modules/cloudpush/blob/master/android/timodule.xml So, if you plan on making a public Android module that depends on Google Play Services, we recommend that you reference it as a dependency in the "timodule.xml" file just like the above. If all modules make a promise to do it this way, then it'll avoid version conflicts. I hope this helps!
Thank you for your help! I can compile it now but only with:
appc ti build -p android --build-only
and then install the APK by hand. When I useappc ti build -p android -T device
I still get: {noformat} [ERROR] Failed to run dexer: [ERROR] [ERROR] UNEXPECTED TOP-LEVEL EXCEPTION: [ERROR] java.lang.RuntimeException: Unexpected exception in dex writer thread [ERROR] at com.android.dx.command.dexer.Main.runMultiDex(Main.java:399) [ERROR] at com.android.dx.command.dexer.Main.runDx(Main.java:289) [ERROR] at com.android.dx.command.dexer.Main.main(Main.java:247) [ERROR] at com.android.dx.command.Main.main(Main.java:94) {noformat} For me it looks like a timeout because it takes ages till the error appears. Build-only works faster. But thanks again, it works without the support modules!Hmm... I'm able to compile for device just fine. And I was able to run the built app with the hyperloop code snippet you gave me in Slack as well. Perhaps it's an incremental build issue? Try deleting your project's generated "build" directory and re-build again. If that doesn't work, then we may need to double check the version of support/google-play libraries that your Samsung pass library depends on. This is in case it depends on a newer version than what Titanium includes.
I'll try that. I found this https://stackoverflow.com/a/32605696/5193915: setting
javaMaxHeapSize "4g"
which I'm trying tomorrow. That would sound like the timeout I was thinking about.Oh wow. I'm guessing your app contains more libraries/modules then eh? If I recall correctly, the current max is 1 gb. I've never exceeded it before. Java has a "_JAVA_OPTIONS" environment variable where I believe you can set the
-Xmx2g
flag for 2 GB. I've never tried it that way before, but that "should" allow you to quickly test it if this is the case. https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html#wp1003092 https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html I'll see about playing with this later. If it is a JVM max heap size issue, then we'll have to look into bumping it up in our build tools. Thanks.Not that many modules (65 lines of jar's that are included in the last java/dex command if you put every jar in an own file. about 50lines 7.3.1 jars and 10 external jars) but a lot of files if that is included in this too. I've used
appc ti config android.dx.maxMemory "4096M"
and it worked right away! Even with 2048M it's working fine. Default is 1024M as you've said. There is a typo here: https://docs.appcelerator.com/platform/latest/#!/guide/Titanium_CLI_Options-section-src-37549003_TitaniumCLIOptions-android.dx.maxmemory it should be maxMemory instead of maxmemoryFor the CLI config, it's "android.dx.maxMemory". But for the tiapp.xml, it's "android.dx.maxmemory". https://github.com/appcelerator/titanium_mobile/blob/master/android/cli/commands/_build.js#L914 I'm not thrilled about the casing difference, but there it is.
Closing per engineering comments.