Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24013] Hyperloop: Android - Not recognizing all classes from .aar

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-05-04T15:42:07.000+0000
Affected Version/sRelease 5.5.0
Fix Version/sHyperloop 2.1.1
ComponentsAndroid, Hyperloop
Labelsn/a
Reporter Ricardo Ramirez
AssigneeJan Vennemann
Created2016-10-10T21:27:01.000+0000
Updated2018-08-06T17:49:19.000+0000

Description

Issue Description

For the purpose of using custom Java classes, we have created a custom aar file and added it to platform folder. After the build process, even though the class is available in the corresponding classes.jar file, it is giving an error as "Requested module not found" while importing it.

Steps to reproduce:

1.Create an Android module(samplemodule) in Android Studio with some sample class. Let's say it is com.test.FirstClass 2. Build aar file for this module (samplemodule-release.aar) 3. Create an Android project in Appcelerator Stuido and copy the samplemodule-release.aar to android folder in platform section of this new Appcelerator Project. 4. Try to import the class in the android module as follows: var FirstClass = require('com.test.FirstClass'); 5. Everything will work fine. 6. Now add a new class called com.test.SecondClass in the Android module in Android Studio. 7. Clean the Android module and build aar file again (samplemodule-release.aar). 8. Now replace the old aar file in platform folder of Appcelerator project with this new aar file. 9. If you try to import the second class that is created as follows, it will give an error as 'requested module not found'.
var SecondClass = require('com.test.SecondClass');

Attachments

FileDateSize
testmodule-release.aar2016-10-10T21:24:14.000+000015413

Comments

  1. Ricardo Ramirez 2016-10-19

    As discussed on the call, please let me know where i can get the version 2.0.0 to try. Thanks
  2. Ingo Muschenetz 2016-12-01

    [~rramirez] Did you try this again?
  3. Ricardo Ramirez 2016-12-02

    Yes, works since Hyperloop 2.X thanks.
  4. Lokesh Choudhary 2017-02-07

    I was able to successfully reproduce the issue by following the steps in the description. Tried with: SDK 5.5.0.GA, Hyperloop 1.2.8 SDK 6.0.1.GA, Hyperloop 2.0.0 SDK 6.0.1.GA Hyperloop 2.1.0 beta
       [ERROR] :  TiExceptionHandler: (main) [432,432] ----- Titanium Javascript Runtime Error -----
       [ERROR] :  TiExceptionHandler: (main) [1,433] - In ti:/module.js:303,2
       [ERROR] :  TiExceptionHandler: (main) [0,433] - Message: Uncaught Error: Requested module not found: com.example.android.samplemodule.com.test.SecondClass
       [ERROR] :  TiExceptionHandler: (main) [0,433] - Source: 	throw new Error("Requested module not found: " + request); // TODO Set 'code' property to 'MODULE_NOT_FOUND' to match Node?
       [DEBUG] :  OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
       
       [ERROR] :  V8Exception: Exception occurred at ti:/module.js:303: Uncaught Error: Requested module not found: com.example.android.samplemodule.com.test.SecondClass
       
    Appc Studio : 4.8.1.201612050850 SDK Version : 6.1.0.GA. 5.0.0.GA Mac OS Version : 10.12.2 Xcode Version : Xcode 8.2.1 Build version 8C1002 Appc CLI AND Appc NPM : {"NPM":"4.2.9-1","CLI":"6.1.0"} Ti CLI : 5.0.11 Alloy : 1.9.5 Node : v4.6.0 Hyperloop: 1.2.8, 2.0.0, 2.1.0 beta
  5. Jan Vennemann 2017-02-21

    [~rramirez], this is a metabase caching issue for third party libraries. Until we fix this, there is a simple workaround: Look for the following line in the build log:
       [INFO]  [Hyperloop] Generating system metabase
       [INFO]  [Hyperloop] Generated AST cache file at /var/folders/mh/2_3ycdzx0v79p0wglc59lyrh0000gp/T/hyperloop_android-23_metabase.590a5d257d5adc20b7449acdd5dc3ff56514d125.json.gz in 3.089 seconds
       
    Deleting the mentioned cache file will solve the issue. This only needs to be done when a third party library is replaced. Adding a new one or removing an existing one will automatically invalidate the cache file.
  6. Ricardo Ramirez 2017-03-14

    Hii [~jvennemann] can you please tell me where exactly is located this folder /var/folders/mh/2_3ycdzx0v79p0wglc59lyrh0000gp/T/hyperloop_android-23_metabase.590a5d257d5adc20b7449acdd5dc3ff56514d125.json.gz ? รงรง
  7. Jan Vennemann 2017-03-15

    [~rramirez], it's different depending on the .aar files used. You have to look in the build log of the project and search for these lines: When the project is build for the first time or you added/removed an .aar file:
       [INFO]  [Hyperloop] Generating system metabase
       [INFO]  [Hyperloop] Generated AST cache file at /path/to/cache/file/on/your/machine/metabase.json.gz in 3.363 seconds
       
    When you replaced an .aar file:
       [INFO]  [Hyperloop] Using system metabase cache file at /path/to/cache/file/on/your/machine/metabase.json.gz.json.gz
       
  8. Abir Mukherjee 2017-05-01

    I'll discuss this ticket with Eric tomorrow on the status.
  9. Jan Vennemann 2017-05-04

    PR (master): https://github.com/appcelerator/hyperloop.next/pull/168 PR (2_1_X): https://github.com/appcelerator/hyperloop.next/pull/169
  10. Eric Merriman 2018-08-06

    Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.

JSON Source