shripalsoni04 / nativescript-webview-interface

Plugin for bi-directional communication between webView and android/ios
MIT License
89 stars 35 forks source link

Android - Cannot read property 'widgets' of undefined #1

Closed alto1234 closed 8 years ago

alto1234 commented 8 years ago

Hi,

Thanks for a great plugin. Works like a dream on IOS. But whatever i do on Android i get the same problem. Have tried in emulator and on a real phone. Have tried the same code i use on IOS on android and the sample code (https://github.com/shripalsoni04/nativescript-webview-interface-demo). They all give the following error for me.

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.webviewinterfacedemo/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed

TypeError: Cannot read property 'widgets' of undefined File: "/data/data/org.nativescript.webviewinterfacedemo/files/app/tns_modules/ui/frame/frame.js, line: 327, column: 39

StackTrace: Frame: function:'NativeActivity.onCreate', file:'/data/data/org.nativescript.webviewinterfacedemo/files/app/tns_modules/ui/frame/frame.js', line: 327, column: 40

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2442) at android.app.ActivityThread.access$800(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5373) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815) Caused by: com.tns.NativeScriptException: Calling js method onCreate failed

TypeError: Cannot read property 'widgets' of undefined File: "/data/data/org.nativescript.webviewinterfacedemo/files/app/tns_modules/ui/frame/frame.js, line: 327, column: 39

StackTrace: Frame: function:'NativeActivity.onCreate', file:'/data/data/org.nativescript.webviewinterfacedemo/files/app/tns_modules/ui/frame/frame.js', line: 327, column: 40

at com.tns.Platform.callJSMethodNative(Native Method) at com.tns.Platform.dispatchCallJSMethodNative(Platform.java:812) at com.tns.Platform.callJSMethod(Platform.java:711) at com.tns.Platform.callJSMethod(Platform.java:690) at com.tns.Platform.callJSMethod(Platform.java:680) at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:1574) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332) ... 10 more

shripalsoni04 commented 8 years ago

Thanks for reporting the issue.

I think the issue is, you have android runtime version above 1.6.0 and the tns-core-modules at 1.5.x.

I have updated version of runtime and tns-core-module in sample app and tested it.

It should work now. Let me know in case of any issue.

alto1234 commented 8 years ago

@shripalsoni04 you are the best. Thank's for the help and the fast response time. It's now working like a dream on Android two.