{ "id": "102576", "key": "AC-1735", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-10-10T21:16:53.000+0000", "created": "2012-10-03T11:51:35.000+0000", "labels": [], "versions": [], "issuelinks": [ { "id": "34043", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "103072", "key": "TIMOB-11360", "fields": { "summary": "Tooling: Android module build scripts throw NoClassFoundException when native Android project is included as library which has UI built in XML", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:40:37.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "We are in a process to develop a module for an SDK. As per the documentation of the SDK, to use it in an android native project we have to include an extra Android Native Library Project provided with SDK.\r\n\r\nIn order to develop the Titanium Module for this SDK, i have currently consumed all methods exposed by SDK and have exposed it to javascript interface(app.js) using @Kroll Annotations.\r\n\r\nNow, the problem is that in order to make my module work, how should i proceed to include the Android Native Library project provided with SDK in my Titanium Module as this is required by SDK to work. I have found no documentation for the same on developer.appcelerator.com and got no results googling for the same.\r\n\r\nI tried copying contents of Android Library Project to module folders but it is not working and i get java.lang.NullPointerException during runtime when activity of Android Library Project is invoked while using this module in a Titaniun Application. \r\n\r\nFollowing are the steps followed to copy contents of Android Library Project to Titanium Module directories:\r\n1. src folder contents of library project copied to src folder of module project\r\n2. res folder contents of library project copied to platform/android/res folder of module project \r\n3. Entries from tag of AndroidManifest.xml of library project copied to tag of timodule.xml \r\n\r\nPlease help as this is a blocker in implementing Titanium Android Module for the SDK", "attachment": [ { "id": "32456", "filename": "sample_apklib_module.zip", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-09T12:33:35.000+0000", "size": 1662051, "mimeType": "application/zip" }, { "id": "32457", "filename": "Sample_Test_apklib.zip", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-09T12:33:35.000+0000", "size": 159494, "mimeType": "application/zip" }, { "id": "32458", "filename": "Sample-apklib.zip", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-09T12:33:35.000+0000", "size": 82653, "mimeType": "application/zip" } ], "flagged": false, "summary": "Unable to integrate Android Library project with Titanium Module", "creator": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "subtasks": [], "reporter": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "environment": null, "comment": { "comments": [ { "id": "222631", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Please take a look at Step two of [this Guide|https://wiki.appcelerator.org/display/guides2/Android+Module+Development+Guide]\n{code}\nlib - Place any third party JAR dependencies here and they will be bundled up as a part of your module automatically.\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-08T22:41:12.000+0000", "updated": "2012-10-08T22:41:12.000+0000" }, { "id": "222696", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "body": "@Pedro - I am not bundling a third party jar to use some of its classes and methods in my module but what i am trying to use is a android library project having activities which are using custom layouts ", "updateAuthor": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-09T12:20:36.000+0000", "updated": "2012-10-09T12:21:16.000+0000" }, { "id": "222697", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I am adding three files explaining my issue:\r\n1. Sample-apklib.zip: This is the Sample Android Library project i am using in my Sample Android Native Project and want to use with my Sample Titanium Android Module\r\n2. Sample_Test_apklib.zip: This is the Sample Android Native Project using Sample Android Library Project\r\n3. sample_apklib_module.zip: This is the Sample Titanium Android Module in which i am using Sample Android Library Project\r\n=======\r\nISSUE:\r\n=======\r\nWhen i run my Titanium Module and call library project's activity using invoke button defined in test harness \"example/app.js\", i get following error on android log and my application crashes:\r\n\r\nE/TiApplication( 591): (main) [110,2497] Sending event: exception on thread: main msg:java.lang.NoClassDefFoundError: sample.test.apklib.R$layout; Titanium 2.1.3,2012/10/02 16:16,15997d0\r\nE/TiApplication( 591): java.lang.NoClassDefFoundError: sample.test.apklib.R$layout\r\nE/TiApplication( 591): \tat sample.test.apklib.SampleApklibActivity.init(SampleApklibActivity.java:37)\r\nE/TiApplication( 591): \tat sample.test.apklib.SampleApklibActivity.onCreate(SampleApklibActivity.java:22)\r\nE/TiApplication( 591): \tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)\r\nE/TiApplication( 591): \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)\r\nE/TiApplication( 591): \tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)\r\nE/TiApplication( 591): \tat android.app.ActivityThread.access$2300(ActivityThread.java:125)\r\nE/TiApplication( 591): \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)\r\nE/TiApplication( 591): \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\nE/TiApplication( 591): \tat android.os.Looper.loop(Looper.java:123)\r\nE/TiApplication( 591): \tat android.app.ActivityThread.main(ActivityThread.java:4627)\r\nE/TiApplication( 591): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\nE/TiApplication( 591): \tat java.lang.reflect.Method.invoke(Method.java:521)\r\nE/TiApplication( 591): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\r\nE/TiApplication( 591): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\r\nE/TiApplication( 591): \tat dalvik.system.NativeStart.main(Native Method)\r\nE/AndroidRuntime( 591): FATAL EXCEPTION: main\r\nE/AndroidRuntime( 591): java.lang.NoClassDefFoundError: sample.test.apklib.R$layout\r\nE/AndroidRuntime( 591): \tat sample.test.apklib.SampleApklibActivity.init(SampleApklibActivity.java:37)\r\nE/AndroidRuntime( 591): \tat sample.test.apklib.SampleApklibActivity.onCreate(SampleApklibActivity.java:22)\r\nE/AndroidRuntime( 591): \tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)\r\nE/AndroidRuntime( 591): \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)\r\nE/AndroidRuntime( 591): \tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)\r\nE/AndroidRuntime( 591): \tat android.app.ActivityThread.access$2300(ActivityThread.java:125)\r\nE/AndroidRuntime( 591): \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)\r\nE/AndroidRuntime( 591): \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\nE/AndroidRuntime( 591): \tat android.os.Looper.loop(Looper.java:123)\r\nE/AndroidRuntime( 591): \tat android.app.ActivityThread.main(ActivityThread.java:4627)\r\nE/AndroidRuntime( 591): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\nE/AndroidRuntime( 591): \tat java.lang.reflect.Method.invoke(Method.java:521)\r\nE/AndroidRuntime( 591): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\r\nE/AndroidRuntime( 591): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\r\nE/AndroidRuntime( 591): \tat dalvik.system.NativeStart.main(Native Method)\r\n\r\nI hope this explains the situation in detail. Please provide a solution as my delivery is stuck because of this issue.", "updateAuthor": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-09T12:33:35.000+0000", "updated": "2012-10-09T12:36:39.000+0000" }, { "id": "222753", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I'm not too sure what you're trying to do, but here are two resources you can look into:\n\n- http://developer.appcelerator.com/question/121573/how-do-i-use-so-library-in-module\n- http://developer.appcelerator.com/blog/2011/01/titanium-and-the-android-ndk.html", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-09T20:05:19.000+0000", "updated": "2012-10-09T20:05:19.000+0000" }, { "id": "222831", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Perminder: Looks like its a bug in our module build scripts. I was able to figure it out after some research. Below is whats happening. If you include any android native library with UI objects build using xml and reference it using R.id.XXX ( as you do it in android ) , our build scripts dont recognize it and throws ClassNotFoundException for R.Java.\n\nHere is what you need to do\n----------------------------\n1. Make the following changes in your 'SampleApklibActivity.java'.\n{code}\n //ViewGroup mainView = (ViewGroup) inflater.inflate(R.layout.apklib, null);\n\t\t//Log.e(\"##CHECKMOD\", \"mainView: \" + String.valueOf(mainView));\n\t\tfinal Activity act = this;\n\t\t//Button btn = (Button) mainView.findViewById(R.id.clickToMessage);\n\t\tButton btn = new Button(this);\n\t\tbtn.setOnClickListener(new View.OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tCharSequence str = new String(\"********** Quick Message ************\");\n\t\t\t\tLog.i(\"##CHECKMOD\", str.toString());\n\n\t\t\t}\n\t\t});\n\n\t\t//this.addContentView(mainView, lp);\n\t\tthis.setContentView(btn);\n{code}\nNote that i have just created a button with normal java widget and add that to the view.\n2. Build the application as normal android application ( Uncheck the 'Is Library' checkbox under project properties->Android ). This is just to see if you can see a button and click works.\n3. Build it as a library ( Check the 'Is library' option by right clicking the project -> properties -> Android ). Clean and build. A jar file should be generated under bin folder of sample.test.apklib.SampleApklibAcitivity project.\n4. Copy the above jar file to 'lib' folder of your module project which is sample_apk_lib_module. Also include the same jar file in your module project build path as an external jar or a library. If you are including as a library, include as user library. Adding a user library is pretty easy with eclipse dialogs.\n5. Now run the following commands in the terminal from the project path.\n{code}\nant clean // to clean the project\nant //to build. should not see any errors.\nant run.emulator //to instantiate an android emulator\nant run //to run the app\n{code}\n6. Or run the example app the traditional way by unzipping the module to titanium root folder and including it in tiapp.xml in the ti project.\n\nHope it helps.\n\nRegards,\nAnirudh\n{code}", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-10T00:21:41.000+0000", "updated": "2012-10-10T00:21:41.000+0000" }, { "id": "222872", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "body": "@Anirudh- Thanks a lot and i really appreciate that you understood my problem to its core and the workaround you provide will very well fit in the samples provided. But, this was just a small slice of a large cake. In current scenario i have to integrate a Library Project provided with a third party Android SDK (which i am exposing through Titanium Module) whose activity has a large number of UI elements which are difficult to program in code as there is a very high risk of breaking its UI.\r\n\r\nThough i will try changing code of the Library Project to test the workaround but, is there any possibility that a patch can be provided to me to fix this bug and i do not have to modify the code?\r\n\r\nThanks & Regards,\r\nPerminder\r\n", "updateAuthor": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-10T06:07:28.000+0000", "updated": "2012-10-10T06:09:12.000+0000" }, { "id": "222917", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Perminder: I understand the criticality and your need. I will create a jira ticket for the same and update the same here. But, I believe it should not be difficult to implement all your UI elements in java ( if the UI is not complicated ).", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-10T16:37:59.000+0000", "updated": "2012-10-10T16:37:59.000+0000" }, { "id": "222972", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-10T21:16:16.000+0000", "updated": "2012-10-10T21:16:16.000+0000" }, { "id": "222973", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Jira created", "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-10T21:16:53.000+0000", "updated": "2012-10-10T21:16:53.000+0000" }, { "id": "223049", "author": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "body": "@Anirudh - Thanks a lot for your support. The UI is pretty complex and carries high risk of breaking if coded. I will wait on the ticket (TIMOB-11360) for resolution and hope to get it as early as possible.\n\nThanks & Regards,\nPerminder ", "updateAuthor": { "name": "perminder.singh", "key": "perminder.singh", "displayName": "Perminder Singh Bhatia", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-10-11T06:01:57.000+0000", "updated": "2012-10-11T06:01:57.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }