[TIMOB-23933] Hyperloop - Android: JS Wrappers not being generated for org.json .JAR
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-01-31T19:45:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Hyperloop 3.0.2 |
Components | Hyperloop |
Labels | android, hyperloop, json |
Reporter | Rodolfo Perottoni |
Assignee | Jan Vennemann |
Created | 2016-09-16T00:47:18.000+0000 |
Updated | 2018-02-05T16:53:27.000+0000 |
Description
I'm trying to import the lib *org.json* into a Hyperloop project by placing it inside *app/platform/android*. The lib is contained inside a *jar* file.
I'm building my project and somehow the JS wrappers for this lib are not being generated.
At first I thought jars were not supported, but then I saw that the Hyperloop examples project is using a *.jar* (volley.jar) without any problems.
I've attached the .jar with the mentioned lib so you can try and reproduce the same error.
Attachments
File | Date | Size |
json.jar | 2016-09-21T04:01:09.000+0000 | 84697 |
We cannot work with this ticket at this moment. Please provide: - full trace-log - reproducible example-code - related jar-file
Hey Hans. Sorry for the bad description. I must've had a bad day when I wrote this ticket and didn't notice how poorly described it was. * Full trace log is not necessary in this case - there is no error. * Jar file is attached. Example will be provided in the next comment.
It fails also with SDK 6.0.0 and Hyperloop 2.0. Requiring
does not generate the proper files
[~gmathews] I just noticed that we have [this line](https://github.com/garymathews/hyperloop.next/blob/c704f700041b3ea665188c86cf681774320e67d7/android/plugins/hyperloop/hooks/android/metabase/metabase.js#L75) in our metabase. Could that be something hardcoded that prevents us from adding the
json.jar
manually?Hi, for me, replacing line 66 in JavaMetabaseGenerator.java with this:
does the trick and the bindings for json.jar are generated.
PR: https://github.com/appcelerator/hyperloop.next/pull/268
[~lchoudhary], follow these steps to validate this ticket:
Place the attached
json.jar
underplatform/android
Add the following code to use the JSON library:
Run the app
*Expected behavior* The build succeeds and the app starts without any errors. The following string should be printed to the logs:Verified the fix with hyperloop 3.0.2. Closing. Studio Ver: 5.0.0.201712081732 SDK Ver: 7.0.2.v20180201155017 OS Ver: 10.13.2 Xcode Ver: Xcode 9.2 Appc NPM: 4.2.11 Appc CLI: 7.0.2-master.7 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.12 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1