question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to apply changes on device. Error is: Invalid Version.

See original GitHub issue

Environment

Windows 10 + Android

D:\DANI\vscode\NativeScriptAngularExample>tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.0.1 version and is up to date.
✔ Component @nativescript/core has 8.0.3 version and is up to date.
✖ Component @nativescript/ios is not installed.
✔ Component @nativescript/android has ~8.0.0 version and is up to date.

Describe the bug

When I run the command ns run android to launch the app in a virtual device, the app is built and installed correctly, but it shows the error in console:

Unable to apply changes on device: emulator-5554. Error is: Invalid Version: ~8.0.0.

I have checked that the app is installed in the virtual device and if I open it manually it works properly, it seems the problem only affects to hot-reload of changes.

image image

See complete log of run command:

D:\DANI\vscode\NativeScriptAngularExample>ns run android
Searching for devices...
Preparing project...
webpack is watching the files...
asset vendor.js 16.2 MiB [compared for emit] (name: vendor) (id hint: defaultVendor)
asset bundle.js 461 KiB [emitted] [compared for emit] (name: bundle)
Entrypoint bundle 16.6 MiB = vendor.js 16.2 MiB bundle.js 461 KiB
orphan modules 228 KiB [orphan] 132 modules
runtime modules 25.1 KiB 14 modules
modules by path ./node_modules/ 6.13 MiB
  javascript modules 5.86 MiB 370 modules
  json modules 274 KiB
    modules by path ./node_modules/mdn-data/css/*.json 242 KiB 3 modules
    modules by path ./node_modules/css-tree/ 31.6 KiB 2 modules
modules by path ./src/ 131 KiB
  modules by path ./src/app/ 9.35 KiB
    modules by path ./src/app/*.ts 3.54 KiB 3 modules
    modules by path ./src/app/item/*.ts 5.81 KiB 3 modules
  ./src/main.ts 3.54 KiB [built] [code generated]
  ./src/app.css 118 KiB [built] [code generated]
external "~/package.json" 42 bytes [optional] [built] [code generated]
./$$_lazy_route_resource/ lazy namespace object 160 bytes [built] [code generated]
webpack 5.31.2 compiled successfully in 40511 ms
Webpack compilation complete. Watching for file changes.
File change detected. Starting incremental webpack compilation...
Updating runtime package.json with configuration values...
Project successfully prepared (android)
Unable to apply changes on device: emulator-5554. Error is: Invalid Version: ~8.0.0.

To Reproduce

  1. Install NativeScript in your computer with npm
  2. Create a new sample project using the CLI with the Angular template
  3. Setup the environment as per documentation (ANDROID_HOME, Path)
  4. Install Android SDK >= 28 and create a virtual device for that version
  5. Launch virtual device and run the NativeScript application using the CLI

Expected behavior

The expected behaviour would be to not see any errors in console and have hot-reaload of changes in the virtual device.

Sample project

I’m following the NativeScript Tutorial, the project has been created with the command ns create NativeScriptAngularExample --angular and there are no changes in the project except adding the dev dependency “@nativescript/android”: “~8.0.0” as per documentation.

https://docs.nativescript.org/environment-setup.html#windows-android

I have checked my setup is correct by running the doctor.

See complete log of doctor command:

D:\DANI\vscode\NativeScriptAngularExample>ns doctor android
✔ Getting environment information

No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.0.1 version and is up to date.
✔ Component @nativescript/core has 8.0.3 version and is up to date.
✔ Component @nativescript/android has ~8.0.0 version and is up to date.

Additional context

See configuration of the Android SDK and AVD:

image image

image

Please let me know if you need any further information. Thanks in advance!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
s-ovationcommented, May 19, 2021

@twopelu Here is my workaround.

Remove ~ or ^ from version expressions in the package.json

before (NOT WORKED)

		"@nativescript/android": "~8.0.0",
		"@nativescript/ios": "~8.0.0",

after (WORKED)

		"@nativescript/android": "8.0.0",
		"@nativescript/ios": "8.0.0",

Use API 29 virtual device

Seems NativeScript CLI cannot launch API 30 devices. I created new virtual device which uses API 29 and it works perfectly.

0reactions
mohsenbarzgarcommented, Oct 20, 2022

add package.json :

{
    "nativescript": {
        "id": {
            "ios": "org.nativescript.appidios",
            "android": "org.nativescript.appidandroid"
        },
        "tns-android": {
            "version": "*"
        },
        "tns-ios": {
            "version": "*"
        }
    },
    .........
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Nativescript, Unable to make changes on device. error is
I ran tns run android in my Windows 10 Command prompt with administrator privelleges. Upon execution i get this error. C:\Users\Work\tns-station ...
Read more >
Development Workflow - NativeScript Docs
@nativescript/android must be installed to avoid the "Unable to apply changes on device: emulator-5554. Error is: Invalid Version: null." error. ns run ios....
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix the issue for the current project, click Run > Edit Configurations and change the default JUnit configuration to only include the...
Read more >
Invalid code signature problem with Xcode12 - Apple Developer
I found the solution. Go to your Iphone Settings -> General -> Device Management and "trust" yourself as developer. I hope it fixes...
Read more >
Qlik Sense Sever: can't open imported App. Error "Invalid ...
Qlik Sense Sever: can't open imported App. Error "Invalid Version: null" ... Open the QVF in Qlik sense desktop and make some changes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found