I'm using native-base third party in the react-native project. I'm getting the below error :
error: Error: Unable to resolve module use-subscription from node_modules/native-base/src/core/color-mode/hooks.tsx: use-subscription could not be found within the project or in these directories:
node_modules/native-base/node_modules
node_modules
8 | import type { IHybridContextProps } from './../hybrid-overlay/types';
9 | import { AppState, useColorScheme as _useColorScheme } from 'react-native';
> 10 | import { useSubscription } from 'use-subscription';
| ^
11 |
12 | export const useColorMode = (): IColorModeContextProps => {
13 | const {
at ModuleResolver.resolveDependency (/Users/admin/Nensi/react-nativeProjects/FPG/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:178:15)
at DependencyGraph.resolveDependency (/Users/admin/Nensi/react-nativeProjects/FPG/node_modules/metro/src/node-haste/DependencyGraph.js:264:43)
at Object.resolve (/Users/admin/Nensi/react-nativeProjects/FPG/node_modules/metro/src/lib/transformHelpers.js:170:21)
below is the version used in the project:
"native-base": "^3.4.14",
"react": "18.1.0",
"react-native": "0.70.0",
I am getting the same error in android and ios both.
Any help! Thank you in advance!
Downgrade your native base version to 3.5.0-alpha.8
I have an error since yesterday I try to fix. I successfully built an android apk using:
ionic cordova build android --prod --release
But the app stuck on white screen on device and emulator (GenyMotion). I inspected the logcat of GenyMotion. I figured out these:
> I/chromium( 5497): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token )", source: http://localhost/runtime.fcad956485f9614ff8b1.js (1)
> D/SystemWebChromeClient( 5497): http://localhost/polyfills.49d987a1d15d60566c3f.js: Line 1 : Uncaught SyntaxError: Unexpected token =>
> I/chromium( 5497): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token =>", source: http://localhost/polyfills.49d987a1d15d60566c3f.js (1)
> D/SystemWebChromeClient( 5497): http://localhost/main.2be168d95557cbdc0a3f.js: Line 1 : Uncaught SyntaxError: Unexpected token =>
> I/chromium( 5497): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token =>", source: http://localhost/main.2be168d95557cbdc0a3f.js (1)
I don't know why. They are no errors when building.
My package.json
...
"#angular/common": "~12.0.1",
"#angular/core": "~12.0.1",
"#angular/forms": "~12.0.1",
"#angular/platform-browser": "~12.0.1",
"#angular/platform-browser-dynamic": "~12.0.1",
"#ionic/angular": "^5.5.2",
"ionic": "^5.4.16",
"cordova-android": "^9.0.0",
"cordova-browser": "^6.0.0",
"cordova-ios": "^5.1.1",
"cordova-plugin-ionic-webview": "^5.0.0",
...
"#typescript-eslint/eslint-plugin": "4.16.1",
"#typescript-eslint/parser": "4.16.1",
"typescript": "~4.2.4"
My tsconfig.json.
...
"target": "es2015",
"module": "es2020",
"lib": ["es2018", "dom"]
...
After a real battle in order to fix the issue since 3 days,
i solved the problem.
Ionic 5 angular 12 use es2015 as a target when building.
I set "target" to es5 in tsconfig.json and errors in runtime.**.js, polyfills.**.json disappeared
es5 transform ES6 function to standard functions.
More info at
https://www.typescriptlang.org/tsconfig
Here is pretty clear. You have a syntax error. I suppose you can check logs for ionic cordova build android --prod. Probably It will show which files and lines generate these problems.
If you use linter you can try to run npm run lint to check any problems with your code.
ionic + angular has update the type script compiler in the recent update as
Root folder > tcconfig.json > compilerOptions > target > es2020 - This is causing the issue in android version 29
Chang the target as es2015 to resolve the issue
I'm trying to make an APK of a web app, I wrapped it into Cordova.
I followed various tutorials, installed Gradle and made it work.
When i run cordova build android ---verbose from CMD, I get this error:
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\USER\AppData\Local\Android\sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Running command: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug -b C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Command finished with error code 1: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug,-b,C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Error: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
at ChildProcess.whenDone (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:310:20)
at ChildProcess.cp.emit (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
Using Gradle 6.3
I tried a lot of tutorials and StackOverflow solution, but none of them work for me.
My gradle-wrapper.properties
Tue Oct 16 17:39:45 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=C:\Users\USER\Downloads\gradle-6.3-bin.zip
I am using gradle 5.1.1 for cordova9.0.
There is no problems.
I'm trying to create an app using Nativescript Sidekick using angular/typescript.
When I try and preview the app on my android devices it only shows the errors below.
I have tried running the preview several times on multiple android devices.
As soon as I make changes to the app.component.ts file the nativescript preview app begins showing the below list of errors
This snippet works
import { Component } from "#angular/core";
#Component({
moduleId: module.id,
selector: "ns-app",
templateUrl: "app.component.html"
})
export class AppComponent { }
This snippet does not
import { Component } from "#angular/core";
#Component({
selector: "gr-login",
moduleId: module.id,
templateUrl: "./login/login.component.html"
})
export class AppComponent {}
LOG from device Marvin: Angular is running in the development mode. Call >enableProdMode() to enable the production mode.
LOG from device Marvin: HMR: Checking for updates to the bundle with hmr >hash 4a9d4dd775f015fffecd.
LOG from device Marvin: Angular is running in the development mode. Call >enableProdMode() to enable the production mode. LOG from device
Marvin: HMR: ↻ ./app/app.module.ts LOG from device Marvin:
HMR: Successfully applied update with hmr hash 4a9d4dd775f015fffecd.
App is up to date. LOG from device Marvin: HMR: ↻
./app/app.component.ts LOG from device Marvin: HMR: The following
modules were updated: LOG from device Marvin: HMR: Checking for
updates to the bundle with hmr hash c892cbd39be51a20e8ba. LOG from
device Marvin: HMR: The following modules were updated: LOG from
device Marvin: HMR: ↻ ./app/app.component.ts LOG from device
Marvin: HMR: ↻ ./app/app.component.html LOG from device
Marvin: HMR: ↻ ./app/login/login.component.html LOG from
device Marvin: HMR: ↻ ./app/app.module.ts LOG from device
Marvin: HMR: Successfully applied update with hmr hash
c892cbd39be51a20e8ba. App is up to date. LOG from device Marvin:
Angular is running in the development mode. Call enableProdMode() to
enable the production mode. LOG from device Marvin: An uncaught
Exception occurred on "main" thread. Calling js method run failed
Error: Failed to create View with entry.create() function.
StackTrace:
Frame: function:'ZoneAwareError', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 1298, column: 31
Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/builder/builder.js',
line: 45, column: 13
Frame: function:'ActivityCallbacksImplementation.setActivityContent',
file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',
line: 985, column: 32
Frame: function:'ActivityCallbacksImplementation.resetActivityContent',
file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',
line: 946, column: 10
Frame: function:'_resetRootView', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js',
line: 125, column: 13
Frame: function:'NativeScriptPlatformRef._livesync', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/platform-common.js',
line: 268, column: 19
Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/platform-common.js',
line: 97, column: 80
Frame: function:'ZoneDelegate.invokeTask', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 421, column: 23
Frame: function:'Zone.runTask', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 188, column: 39
Frame: function:'ZoneTask.invokeTask', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 496, column: 28
Frame: function:'ZoneTask.invoke', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 485, column: 40
Frame: function:'timer', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 1561, column: 23
Frame: function:'invoke', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/timer/timer.js',
line: 19, column: 45
Frame: function:'ZoneDelegate.invoke', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 388, column: 18
Frame: function:'Zone.runGuarded', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 151, column: 39
Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 129, column: 23
Frame: function:'run', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/timer/timer.js',
line: 23, column: 7
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
at com.tns.Runtime.callJSMethod(Runtime.java:1109)
at com.tns.Runtime.callJSMethod(Runtime.java:1089)
at com.tns.Runtime.callJSMethod(Runtime.java:1081)
at com.tns.gen.java.lang.Runnable.run(Runnable.java:17)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
LOG from device Marvin: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
LOG from device Marvin: HMR: Checking for updates to the bundle with hmr hash c0e7af62393125eaf0d7.
LOG from device Marvin: HMR: ↻ ./app/login/login.component.html
LOG from device Marvin: HMR: Successfully applied update with hmr hash c0e7af62393125eaf0d7. App is up to date.
LOG from device Marvin: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
LOG from device Marvin: HMR: ↻ ./app/app.component.html
LOG from device Marvin: HMR: ↻ ./app/app.module.ts
LOG from device Marvin: HMR: The following modules were updated:
LOG from device Marvin: HMR: ↻ ./app/app.component.ts
LOG from device Marvin: An uncaught Exception occurred on "main" thread.
Calling js method run failed
Error: Failed to create View with entry.create() function.
StackTrace:
Frame: function:'ZoneAwareError', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 1298, column: 31
Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/builder/builder.js',
line: 45, column: 13
Frame: function:'ActivityCallbacksImplementation.setActivityContent',
file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',
line: 985, column: 32
Frame: function:'ActivityCallbacksImplementation.resetActivityContent',
file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',
line: 946, column: 10
Frame: function:'_resetRootView', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js',
line: 125, column: 13
Frame: function:'NativeScriptPlatformRef._livesync', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/platform-common.js',
line: 268, column: 19
Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/platform-common.js',
line: 97, column: 80
Frame: function:'ZoneDelegate.invokeTask', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 421, column: 23
Frame: function:'Zone.runTask', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 188, column: 39
Frame: function:'ZoneTask.invokeTask', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 496, column: 28
Frame: function:'ZoneTask.invoke', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 485, column: 40
Frame: function:'timer', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 1561, column: 23
Frame: function:'invoke', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/timer/timer.js',
line: 19, column: 45
Frame: function:'ZoneDelegate.invoke', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 388, column: 18
Frame: function:'Zone.runGuarded', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 151, column: 39
Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js',
line: 129, column: 23
Frame: function:'run', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/timer/timer.js',
line: 23, column: 7
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
at com.tns.Runtime.callJSMethod(Runtime.java:1109)
at com.tns.Runtime.callJSMethod(Runtime.java:1089)
at com.tns.Runtime.callJSMethod(Runtime.java:1081)
at com.tns.gen.java.lang.Runnable.run(Runnable.java:17)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
LOG from device Marvin: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
LOG from device Marvin: An uncaught Exception occurred on "main" thread.
Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}:
com.tns.NativeScriptException: Calling js method onCreate failed
Error: Main entry is missing. App cannot be started. Verify app bootstrap.
StackTrace:
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}:
com.tns.NativeScriptException: Calling js method onCreate failed
Error: Main entry is missing. App cannot be started. Verify app bootstrap.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3037)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3172)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
Error: Main entry is missing. App cannot be started. Verify app bootstrap.
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
at com.tns.Runtime.callJSMethod(Runtime.java:1109)
at com.tns.Runtime.callJSMethod(Runtime.java:1089)
at com.tns.Runtime.callJSMethod(Runtime.java:1081)
at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:20)
at android.app.Activity.performCreate(Activity.java:7149)
at android.app.Activity.performCreate(Activity.java:7140)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3017)
... 11 more
Add enableProdMode() in main.ts file in the project.
Like:-
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppModule } from "./app/app.module";
import { enableProdMode } from "#angular/core";
enableProdMode();
platformNativeScriptDynamic().bootstrapModule(AppModule);
app.component.ts:-
import { Component } from "#angular/core";
#Component({
moduleId: module.id,
selector: "ns-app",
templateUrl: "app.component.html"
})
export class AppComponent { }
login.component.ts:-
import { Component } from "#angular/core";
#Component({
moduleId: module.id,
selector: "ns-login",
templateUrl: "./login.component.html"
})
export class LoginComponent { }
I'm creating my first application in NativeScript 1.7.0 (android platform for the moment) and I run into this error that crashes the application from time to time when pressing the back button on certain pages. I'm not sure what the exact conditions for this to occur are.
Has anyone else encountered this before? Any ideas why this could be happening and how to fix or avoid it?
NativeScript 1.7.0
tns-core-modules ^1.7.1
tns-android 1.7.1
Here is the information about the exception that is printed in the console:
com.tns.NativeScriptException:
Calling js method onBackPressed failed
Error: Corrupted navigation stack; page: undefined; currentNavigationPage: undefined
File: "/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js, line: 664, column: 43
StackTrace:
Frame: function:'Frame._processNavigationQueue', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame-common.js', line: 173, column: 19
Frame: function:'_completePageAddition', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/transition/transition.js', line: 228, column: 15
Frame: function:'_onFragmentShown', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/transition/transition.js', line: 197, column: 9
Frame: function:'onFragmentShown', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js', line: 43, column: 22
Frame: function:'FragmentClass.onCreateView', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js', line: 537, column: 13
Frame: function:'NativeScriptActivity.onBackPressed', file:'/data/data/com.carteplay.consumer/files/app/tns_modules/ui/frame/frame.js', line: 664, column: 44
at com.tns.Platform.callJSMethodNative(Native Method)
at com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816)
at com.tns.Platform.callJSMethod(Platform.java:715)
at com.tns.Platform.callJSMethod(Platform.java:694)
at com.tns.Platform.callJSMethod(Platform.java:684)
at com.tns.NativeScriptActivity.onBackPressed(NativeScriptActivity.java:41)
at android.app.Activity.onKeyUp(Activity.java:2179)
at android.view.KeyEvent.dispatch(KeyEvent.java:2650)
at android.app.Activity.dispatchKeyEvent(Activity.java:2424)
at com.tns.NativeScriptActivity.dispatchKeyEvent(NativeScriptActivity.java)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1877)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3884)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3867)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3463)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3513)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3482)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3567)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3490)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3624)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3463)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3513)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3482)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3490)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3463)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3513)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3482)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3600)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:3752)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2022)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1738)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1729)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:1999)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:133)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:5457)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Please make sure you are using Android 1.7.1 or later of both the tns-core-modules and of the platform. Several versions of NS had some navigation issues. My understanding is they all should be solved in v1.7.1
To upgrade; change to your main project directory and do each of these simple commands:
npm install tns-core-modules#latest -s
tns platform remove android
tns platform add android
Then you can type a "cat package.json" or "type package.json" and you should see both the platform and core modules at v1.7.1 or greater.