{ "id": "163857", "key": "TIMOB-24012", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-10-12T19:56:02.000+0000", "created": "2016-10-10T19:49:46.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "qe-6.0.0" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "issuelinks": [ { "id": "53061", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "163908", "key": "TIMOB-24021", "fields": { "summary": "Hyperloop: Android: require of native class android.content.Intent fails on SDK 6+", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "53044", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "163854", "key": "TIMOB-24011", "fields": { "summary": "iOS: require fails to resolve paths like 'hyperloop/uikit/uilabel'", "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": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2018-08-06T17:49:24.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": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "13715", "name": "Hyperloop", "description": "Hyperloop project" } ], "description": "Attempting to load a JS resource that does not exist underneath a native nodule will result in Android crashing. This is most obvious using Hyperloop where paths are generated like {{require('hyperloop/android.content.Intent')}} under the hood. We then attempt to load 'android.content.Intent' as a JS resource inside the native hyperloop module.\r\n\r\nUsing proper paths like: {{require('/hyperloop/android.com.Intent')}} works around this issue, but doesn't address the root bug. This bug appears to be an existing issue, not a regression.\r\n\r\nh4. Steps to reproduce:\r\n# Import the hyperloop example application [here|https://github.com/appcelerator/hyperloop-examples].\r\n# Or use the app.js below.\r\n\r\nh4. app.js\r\n{noformat}\r\nvar Intent = require('android.content.Intent');\r\nvar intent = Ti.Android.createIntent();\r\nvar nativeIntent = new Intent(intent); // Fails\r\n{noformat}\r\n\r\n\r\nh4. Actual\r\n{noformat}\r\n[INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: obj == null\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] in call to CallObjectMethodV\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] from void org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(java.lang.String, java.lang.String, org.appcelerator.kroll.KrollProxySupport)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] \"main\" prio=5 tid=1 Runnable\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] | group=\"main\" sCount=0 dsCount=0 obj=0x73b922a0 self=0xf4e76500\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] | sysTid=10996 nice=0 cgrp=default sched=0/0 handle=0xf7028b34\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 523465687 16614272 137 ) utm=41 stm=10 core=4 HZ=100\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] | stack=0xff616000-0xff618000 stackSize=8MB\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] | held mutexes= \"mutator lock\"(shared held)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #00 pc 0035a55f /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+126)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #01 pc 0033b0e7 /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+138)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #02 pc 0024dfcb /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+750)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #03 pc 0024e6d3 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+62)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #04 pc 0027d48f /system/lib/libart.so (_ZN3art3JNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+458)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #05 pc 002c2839 /data/app/com.appc.intents-1/lib/arm/libkroll-v8.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+28)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #06 pc 002c4c57 /data/app/com.appc.intents-1/lib/arm/libkroll-v8.so (_ZN8titanium13KrollBindings25getExternalCommonJsModuleERKN2v820FunctionCallbackInfoINS1_5ValueEEE+458)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #07 pc 003b73e4 /data/app/com.appc.intents-1/lib/arm/libkroll-v8.so (_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE+136)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #08 pc 00407dec /data/app/com.appc.intents-1/lib/arm/libkroll-v8.so (???)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #09 pc 0040845c /data/app/com.appc.intents-1/lib/arm/libkroll-v8.so (???)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] native: #10 pc 00000098 (???)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native method)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:196)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:241)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:128)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:183)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:107)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:675)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:169)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:96)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.Activity.performCreate(Activity.java:6251)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.ActivityThread.-wrap11(ActivityThread.java:-1)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.os.Handler.dispatchMessage(Handler.java:102)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.os.Looper.loop(Looper.java:148)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at android.app.ActivityThread.main(ActivityThread.java:5422)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at java.lang.reflect.Method.invoke!(Native method)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\r\n[INFO] : art: art/runtime/java_vm_ext.cc:410]\r\n[INFO] : art: art/runtime/runtime.cc:366] Runtime aborting...\r\n[INFO] : art: art/runtime/runtime.cc:366] Aborting thread:\r\n[INFO] : art: art/runtime/runtime.cc:366] \"main\" prio=5 tid=1 Native\r\n[INFO] : art: art/runtime/runtime.cc:366] | group=\"\" sCount=0 dsCount=0 obj=0x73b922a0 self=0xf4e76500\r\n[INFO] : art: art/runtime/runtime.cc:366] | sysTid=10996 nice=0 cgrp=default sched=0/0 handle=0xf7028b34\r\n[INFO] : art: art/runtime/runtime.cc:366] | state=R schedstat=( 549853712 16660679 138 ) utm=41 stm=12 core=4 HZ=100\r\n[INFO] : art: art/runtime/runtime.cc:366] | stack=0xff616000-0xff618000 stackSize=8MB\r\n[INFO] : art: art/runtime/runtime.cc:366] | held mutexes= \"abort lock\"\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #00 pc 0035a55f /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+126)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #01 pc 0033b0e7 /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+138)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #02 pc 0031f455 /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+20)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #03 pc 0031f6d1 /system/lib/libart.so (_ZN3art7Runtime5AbortEv+540)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #04 pc 000f3969 /system/lib/libart.so (_ZN3art10LogMessageD2Ev+2092)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #05 pc 0024e2d5 /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1528)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #06 pc 0024e6d3 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+62)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #07 pc 0027d48f /system/lib/libart.so (_ZN3art3JNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+458)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #08 pc 002c2839 /data/app/com.appc.intents-1/lib/arm/libkroll-v8.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+28)\r\n[INFO] : art: art/runtime/runtime.cc:366] native: #09 pc 002c4c57 /data/app/com.appc.intent\r\n{noformat}\r\n\r\n\r\nh4. Expected\r\nNo error is thrown.", "attachment": [], "flagged": false, "summary": "Android: crashing trying to load non-existing JS resources inside native modules", "creator": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "environment": "Mac OSX Sierra 10.12\r\nTi SDK: 6.0.0.v20161010093913\r\nAppc Studio: 4.8.0.201609292239\r\nAppc NPM: 4.2.8-7\r\nApp CLI: 6.0.0-57\r\nHyperloop: 2.0.0 beta 3\r\nNode v4.4.7", "closedSprints": [ { "id": 733, "state": "closed", "name": "2016 Sprint 21 SDK", "startDate": "2016-10-08T00:53:00.000Z", "endDate": "2016-10-22T00:53:00.000Z", "completeDate": "2016-10-24T03:58:08.547Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "398531", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "The root cause here is the KrollBindings.getExternalCommonJsModule() call. It's saying the methodID used to call a native Java method (specifically to load source code) is null.\r\n\r\nIf I were to guess it's probably because we have some mismatch on the internal map we store between module ids and the KrollSourceProvider instance/method used to retrieve the source.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-10-10T20:06:38.000+0000", "updated": "2016-10-10T20:06:38.000+0000" }, { "id": "398532", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "May be related to iOS issue, we may only be crashing when requiring a path _under_ a native module?", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-10-10T20:13:35.000+0000", "updated": "2016-10-10T20:13:35.000+0000" }, { "id": "398554", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "I combined this fix with the similar fix on iOS. Should likely cherry-pick the two commits to 6_0_X if the PR is approved/merged.\r\n\r\n\r\nAndroid 6.1.0/master PR: https://github.com/appcelerator/titanium_mobile/pull/8493", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-10-10T23:28:00.000+0000", "updated": "2016-10-10T23:28:00.000+0000" }, { "id": "398738", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~cwilliams], If I run \r\n{code}\r\nvar Intent = require('android.content.Intent');\r\nvar intent = Ti.Android.createIntent();\r\nvar nativeIntent = new Intent(intent);\r\n{code}\r\nwith the fix in master 6.1.0.v20161012092744 I get the following error:\r\n{code}\r\n[ERROR] : TiExceptionHandler: (main) [138,138] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : TiExceptionHandler: (main) [1,139] - In ti:/module.js:301,2\r\n[ERROR] : TiExceptionHandler: (main) [0,139] - Message: Uncaught Error: Requested module not found: android.content\r\n[ERROR] : TiExceptionHandler: (main) [0,139] - Source: \tthrow new Error(\"Requested module not found: \" + request); // TODO Set 'code' property to 'MODULE_NOT_FOUND' to match Node?\r\n{code}\r\n\r\nEnvironment:\r\nAppc Studio : 4.8.0.201610060953\r\nTi SDK : 6.1.0.v20161012092744\r\nTi CLI : 5.0.10\r\nAlloy : 1.9.2\r\nMAC El Capitan : 10.11.6\r\nAppc NPM : 4.2.8-7\r\nAppc CLI : 6.0.0-57\r\nNode: 4.6.0\r\nHyperloop: 2.0.0 on preprod", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-10-12T18:59:36.000+0000", "updated": "2016-10-12T18:59:36.000+0000" }, { "id": "398750", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "[~lchoudhary] Are you testing with hyperloop 2.0.0 as well? That sample code is actually hyperloop code.\r\n\r\nIf you just want to test the fix in the SDK without hyperloop, we need to set up something like what I added to the unit tests. Basically you want to try and require a path whose first segment matches a native module id used by the project, but that doesn't actually live in that module.\r\n\r\nYou could try just doing:\r\n{code:javascript}\r\nvar dont_crash = require('facebook/madeup');\r\n{code}\r\n\r\nIn a project that has the Facebook module in the tiapp.xml modules listing for android.\r\n\r\nThat used to crash the app. Now I assume it'll throw an error about being unable to require the file. If you wanted to go further and do what the unit test does already, you can then add a 'facebook' folder in the app's Resources folder. Then inside that, add a 'madeup.js' file with these contents:\r\n{code:javascript}\r\nmodule.exports = {\r\n name: 'madeup.js'\r\n};\r\n{code}\r\n\r\nThen this in your app.js should work:\r\n{code:javascript}\r\nvar dont_crash = require('facebook/madeup');\r\nTi.API.info(dont_crash.name);\r\n{code}", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-10-12T19:18:07.000+0000", "updated": "2016-10-12T19:18:07.000+0000" }, { "id": "398766", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "ah crap, I'm getting the same thing. Looking at it now...", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-10-12T19:27:54.000+0000", "updated": "2016-10-12T19:27:54.000+0000" }, { "id": "398770", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "So there's actually other issues that are causing what you see [~lchoudhary]. I'm going to open proper tickets for those, as they're actually in the hyperloop module itself. For now, you should be able to confirm this particular Android SDK fix with the steps I outlined above.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-10-12T19:55:58.000+0000", "updated": "2016-10-12T19:55:58.000+0000" }, { "id": "440155", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:49:24.000+0000", "updated": "2018-08-06T17:49:24.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }