HomeFrameworksNativeScriptNativeScript Troubleshooting and Getting Help

NativeScript Troubleshooting and Getting Help

The NativeScript framework has a vibrant community thatā€™s here to help when you run into problems.

If you hit an issue, start by seeing if anyone else has reported the problem onĀ the NativeScript community forum. If you canā€™t find any information, try creating a new forum topic with any details needed to recreate the issue.

If youā€™ve found an issue with the NativeScript framework itself, please report the problem in the appropriate GitHub repository.

Known Issues and Some Limitations

There are a few known issues that the developers might whileĀ developing mobile applications with NativeScript. Below are some of the common problems the developers might run into, as well as the workarounds they can use to continue developing.

My app broke after switching git branches

Problem:Ā After switching branches, the app no longer builds, or does not display new changes.

Solution:Ā The NativeScript CLI generates platform-specific native projects in the platforms/android and platform/ios folders. When you switch branches you may need to regenerate those native projects for your app to function correctly.

Start by removing the existing platform(s) with theĀ tns platform removeĀ command.

tns platform remove ios
tns platform remove android

Next, add back the platformsā€”as well as install any new npm dependenciesā€”using theĀ tns installcommand.


tnsĀ install

Files added to the App_Resources folder are not working

Problem:Ā When you add images or files to your app’sĀ App_ResourcesĀ folder, run the app, and the images don’t show up when they should.

Solution:Ā When you add files to theĀ App_ResourcesĀ folder you have to run a newĀ buildĀ of the app. Files located inĀ App_ResourcesĀ are compiled into the executable so they can’t be synced with a previous build. Here are the correct steps to take to resolve the problem:

  • Uninstall the old .apk (Android) or .ipa (iOS) from the device or emulator you are running the app on.
  • Execute theĀ tns build androidĀ orĀ tns build iosĀ command to create a new .apk or .ipa for your app.
  • Execute theĀ tns run androidĀ orĀ tns run iosĀ command to install the new executable, and you’ll find your files are now packaged into your application.
TheĀ debugĀ command times out on Android devices

Problem:Ā TheĀ debugĀ command times out when you attempt to debug on Android devices or emulators and the debug tools do not start.
TheĀ debugĀ command is configured with a 30-second timeout. On slower computer configurations, the CLI might exceed this timeout when connecting to your Android devices or emulators.

Solution:Ā Re-run theĀ debugĀ command. If you continue to have issue with your Android emulator performance, you may want to consider using a more performant third-party emulator option such asĀ Genymotion.

The debug tools for Android never launch on macOS

Problem:Ā The NativeScript CLI uses theĀ opener npm packageĀ to open Chrome. The current version of the package that the CLI uses cannot open the browser.

Solution:Ā Update the opener package to a newer version. If this does not resolve the issue, try modifying your local copy of the package.

RELATED ARTICLES

Most Popular