Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5075] Android native module build script doesn't correctly generate R.java for included libraries

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2017-08-18T21:52:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsandoid, cli, module, module_CLI, native
ReporterAndrea Vitale
AssigneeShak Hossain
Created2017-07-10T12:38:34.000+0000
Updated2017-08-18T21:52:06.000+0000

Description

I'm trying to make a module that include a library with its own layout places under platform/android/res folder. Inside the module manifest I also specified respackage com.libray.included. I build the module using ti build -p android --build-only, unpack it in my sample app, run the app and when I call the module I get:
[WARN]  W/System.err: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/library/included/R$layout;
[WARN]  W/System.err:     at com.library.included.CustomView.<init>(CustomView.java:131)
[WARN]  W/System.err:     at com.library.included.CustomView.make(CustomView.java:138)
[WARN]  W/System.err:     at av.snackbar.SnackbarProxy.make(CustomProxy.java:60)
[WARN]  W/System.err:     at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
[WARN]  W/System.err:     at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)
[WARN]  W/System.err:     at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)
[WARN]  W/System.err:     at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:147)
[WARN]  W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
[WARN]  W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN]  W/System.err:     at android.os.Looper.loop(Looper.java:148)
[WARN]  W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5417)
[WARN]  W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
[WARN]  W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[WARN]  W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
If you try to build the module using ant, install the module inside the app and running it the module will work as well.

Comments

  1. Aminul Islam 2017-08-02

    Hi, Thanks for reaching out. Can you be more specific about your issue? Do you have a third-party JAR or AAR in your module? If yes, add the JAR file to the module's lib directory. Please take a look: [Add a Third-Party library ](http://docs.appcelerator.com/platform/latest/#!/guide/Android_Module_Project-section-src-43289002_AndroidModuleProject-AddaThird-PartyJAR)

JSON Source