bradmartin / nativescript-advanced-webview

NativeScript plugin for Chrome CustomTabs on Android and SafariViewController on iOS.
Other
60 stars 28 forks source link

Error calling module function #29

Closed mendokar closed 6 years ago

mendokar commented 6 years ago

Good day, I am presenting the following error in Android, could you help me please.

System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: System.err: System.err: Error calling module function System.err: System.err: TypeError: Cannot read property 'init' of undefined System.err: File: "file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js, line: 9, column: 42 System.err: System.err: StackTrace: System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: System.err: TypeError: Cannot read property 'init' of undefined System.err: File: ", line: 1, column: 265 System.err: System.err: StackTrace: System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5447) System.err: at android.app.ActivityThread.-wrap2(ActivityThread.java) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558) System.err: at android.os.Handler.dispatchMessage(Handler.java:102) System.err: at android.os.Looper.loop(Looper.java:154) System.err: at android.app.ActivityThread.main(ActivityThread.java:6165) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778) System.err: Caused by: com.tns.NativeScriptException: System.err: System.err: Error calling module function System.err: System.err: TypeError: Cannot read property 'init' of undefined System.err: File: "file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js, line: 9, column: 42 System.err: System.err: StackTrace: System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: System.err: TypeError: Cannot read property 'init' of undefined System.err: File: ", line: 1, column: 265 System.err: System.err: StackTrace: System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:530) System.err: at com.tns.Runtime.run(Runtime.java:522) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:19) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1046) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5444) System.err: ... 8 more ActivityManager: Process org.nativescript.VetsCol (pid 24483) has died ActivityManager: cleanUpApplicationRecord -- 24483

triniwiz commented 6 years ago

how are you calling the init code ?

mendokar commented 6 years ago

how is the example in my main.ts

import { platformNativeScriptDynamic } from "nativescript-angular/platform"; import { AppModule } from "./app.module";

import { init } from 'nativescript-advanced-webview'; init();

platformNativeScriptDynamic().bootstrapModule(AppModule);

mdconaway commented 6 years ago

I was having the same issue, but I think I found a potential fix.

Try running the following command in your project after you have installed this plugin: tns platform clean android

Whenever I am having plugin issues that command seems to fix things about 90% of the time.

Hope it works for you!