Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24466] Hyperloop: Android - R classes not generated from AAR

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sHyperloop 2.0.0
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterJan Vennemann
AssigneeUnknown
Created2017-03-08T17:51:10.000+0000
Updated2018-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

FileDateSize
testlibrary-debug.aar2017-03-08T17:51:07.000+000015582

Comments

No comments

JSON Source