[TIMOB-24466] Hyperloop: Android - R classes not generated from AAR
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Hyperloop 2.0.0 |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Jan Vennemann |
Assignee | Unknown |
Created | 2017-03-08T17:51:10.000+0000 |
Updated | 2018-02-28T19:55:09.000+0000 |
Description
*Steps to reproduce the behavior*
1. Create a Hyperloop enabled classic project
2. Drop the attached .aar that contains resources into
platform/android
folder
3. Add the following code to Resources/app.js
var R = require('com.example.testlibrary.R');
var helloText = currentActivity.getString(R.string.hello_world);
Ti.API.debug(helloText);
*Actual behavior*
The following error is thrown
[ERROR] TiExceptionHandler: (main) [107,107] ----- Titanium Javascript Runtime Error -----
[ERROR] TiExceptionHandler: (main) [0,107] - In ti:/module.js:303,2
[ERROR] TiExceptionHandler: (main) [0,107] - Message: Uncaught Error: Requested module not found: com.example.testlibrary.R
[ERROR] TiExceptionHandler: (main) [0,107] - Source: throw new Error("Requested module not found: " + request); // TODO Set 'code' property to 'MODULE_NOT_FOUND' to match Node?
[ERROR] V8Exception: Exception occurred at ti:/module.js:303: Uncaught Error: Requested module not found: com.example.testlibrary.R
*Expected behavior*
The string "Hello World!" should be printed to debug log.
*Additional notes*
This is kind of an edge use-case and only occurs if you want to access the specific R class from an .aar file. The library itself still works because AAPT will create a new R class which contains the resource ids from the App and all .aar files. The same issue occurs if two .aar files depend on each other and use the other one's R class.
TIMOB-18565 introduces AAR handling for Ti modules which includes code that will generated the missing R files. The code from there should be reused and also be applied to Hyperloop.
Attachments
File | Date | Size |
---|---|---|
testlibrary-debug.aar | 2017-03-08T17:51:07.000+0000 | 15582 |
No comments