[TIMOB-24022] Hyperloop: Android: Unable to instantiate hyperloop classes
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Critical | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2016-10-12T21:12:34.000+0000 | 
| Affected Version/s | Hyperloop 2.0.0 | 
| Fix Version/s | Release 6.0.0, Hyperloop 2.0.0 | 
| Components | Android, Hyperloop | 
| Labels | n/a | 
| Reporter | Christopher Williams | 
| Assignee | Christopher Williams | 
| Created | 2016-10-12T20:00:33.000+0000 | 
| Updated | 2016-10-25T01:19:51.000+0000 | 
Description
	When attempting to instantiate a native class in JS, we end up with a class cast exception about casting a String to Integer.
Attachments
| File | Date | Size | 
|---|---|---|
| Screen Shot 2016-10-12 at 3.59.13 PM.png | 2016-10-12T19:59:25.000+0000 | 191580 | 
This is a result of a behavior change due to the fix for TIMOB-23966. We now force JS objects to turn into Map
To test, try this as your app.js in a hyperloop project:
var Intent = require('android.content.Intent'); var Activity = require('android.app.Activity'); var Uri = require("android.net.Uri"); var win = Ti.UI.createWindow({ backgroundColor: "#fff" }); var btn = Ti.UI.createButton({ title: "Trigger" }); btn.addEventListener("click", openIntent); win.add(btn); win.open(); function openIntent() { var activity = new Activity(Ti.Android.currentActivity); var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_VIEW }); var nativeIntent = new Intent(intent); nativeIntent.setData(Uri.parse("sms://")); nativeIntent.putExtra("sms_body", "Hello world!"); activity.startActivity(nativeIntent); }PR (master): https://github.com/appcelerator/hyperloop.next/pull/86 PR (2_0_X): https://github.com/appcelerator/hyperloop.next/pull/85
Verified the fix. Hyperloop classes can be instantiated successfully. Closing. Appc Studio : 4.8.0.201610171310 SDK Version : 6.0.0.v20161024145110 Mac OS Version : 10.11.6 Xcode Version : Xcode 8.0 Build version 8A218a Appc CLI AND Appc NPM : {"NPM":"4.2.8-9","CLI":"6.0.0-64"} Ti CLI : 5.0.10 Alloy : 1.9.3 Node : v4.6.0 Hyperloop: 2.0.0 Beta 4