[TIMOB-25372] Hyperloop: The module android.support.v4.content.ContextCompat is missing with TiSDK 6.2.2.GA
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-10-17T21:17:23.000+0000 |
Affected Version/s | Release 6.2.2 |
Fix Version/s | Hyperloop 2.2.0 |
Components | n/a |
Labels | Escalation |
Reporter | Aminul Islam |
Assignee | Gary Mathews |
Created | 2017-10-05T19:18:21.000+0000 |
Updated | 2017-10-19T00:14:03.000+0000 |
Description
Hi,
While updating an app from the SDK 6.1.2 to 6.2.2, We found an issue with a custom android Hyperloop class that works as an audio record permissions check.The module android.support.v4.content.ContextCompat is missing with TiSDK 6.2.2.GA
This error is not happening when using SDK 6.1.2
Test code:
*ti.checkSelfPermission.js*
* @author cenciso
*/
// Imports from Android SDK
var Manifest = require('android.Manifest');
var PackageManager = require('android.content.pm.PackageManager');
var ContextCompat = require('android.support.v4.content.ContextCompat');
var Activity = require('android.app.Activity');
/**
* @method hasRecordPermissions
* Validates audio record permissions
* @return {Boolean}
*/
exports.hasRecordPermissions = function () {
var currentActivity = new Activity(Ti.Android.currentActivity);
var permission = ContextCompat.checkSelfPermission(currentActivity.getApplicationContext(), Manifest.permission.RECORD_AUDIO);
if (permission == PackageManager.PERMISSION_GRANTED) {
return true;
} else if (permission == PackageManager.PERMISSION_DENIED) {
return false;
} else {
console.warn(LOG_TAG, 'hasRecordPermissions returned ' + permission);
return false;
}
};
*index.js*
/**
* @property {Hyperloop.android.checkSelfPermission} permission The permission object.
*/
var permission = require('ti.checkSelfPermission');
function doClick(e) {
var hasPermissions = permission && permission.hasRecordPermissions();
alert('App has record permissions:' + hasPermissions);
}
$.index.open();
Error Log:
[ERROR] : TiExceptionHandler: (main) [323,323] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,323] - In ti:/module.js:305,2
[ERROR] : TiExceptionHandler: (main) [0,323] - Message: Uncaught Error: Requested module not found: android.support.v4.content.ContextCompat
[ERROR] : TiExceptionHandler: (main) [0,323] - 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:305: Uncaught Error: Requested module not found: android.support.v4.content.ContextCompat
Thanks
Attachments
File | Date | Size |
---|---|---|
TestHyperloop.zip | 2017-10-05T19:23:26.000+0000 | 10474308 |
I was able to reproduce the issue with SDK 6.2.2.GA, 6.2.1.GA & 6.2.0.GA. Studio Ver: 4.10.0.201709271713 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.3.0-master.6 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.5 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1
Environment: Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.13 Appc CLI: 6.2.4 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.1.2 and 6.2.2 Appcelerator Studio vers 4.10.0 Hyperloop 2.1.3 Android 6.0.1 (Nexus 6) I used the test app provided in the ticket and reproduced the runtime failure with 6.2.2. I checked with SDK 6.1.2, and the app worked without errors, and an alert popped up after pushing the "Hello World" button.
master: https://github.com/appcelerator/hyperloop.next/pull/230
6_2_X: https://github.com/appcelerator/hyperloop.next/pull/231
Verified the fix with hyperloop 2.2.0 RC5.
is *not* thrown & clicking on the label runs the
ti.checkSelfPermission.js
code. Closing. Studio Ver: 4.10.0.201709271713 SDK Ver: 6.3.0.v20171018084007 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.10-2 Appc CLI: 6.3.0-master.14 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.5 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1