Hi,
I am running "tns run android" and seeing the following in the terminal logs but the app doesn't launch.
Project successfully built
The system failed to delete the package for an unspecified reason.
Successfully deployed on device with identifier '********'.
Steps I took to hit this issue:
1) I created a brand new project by running "tns create sampleApp".
2) Go in the directory and run "tns run android", everything works and the app launches.
3) Stop the app. Open package.json and changed the application package name by changing nativescript.id
4) ran "tns platform remove android", "tns install", "tns platform add android"
5) finally ran "tns run android", it builds but the app doesn't lanuch.
I have tried uninstalling the original application manually from the device but it still shows the log that its successfully deployed but doesn't launch. Did I do something wrong? or is that not the right way to change the package name? Any help would be appreciated.
I am using nativescript version 2.2.1, developing on Mac OSX for Android.
Thanks
Hello @sunny061
The thing is that when you changed your nativescript id in _package.json_ the app is building with the new id and is deployed on the emulator with that id. However, in the same time the NativeScript CLI is trying to launch the app with the id located in app.gradle.(which at this time is still the old one.)
Steps to resolve:
In your _package.json_ if you have
"nativescript": {
"id": "org.nativescript.myNewName",
then go to _app/App_Resources/Android/app.gradle_ and change applicationId value
android {
defaultConfig {
generatedDensities = []
applicationId = "org.nativescript.myNewName"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Then remove the platforms folder, rebuild and your app will be deployed and launched successfully on your emulator/device.
Just tried it and it works as expected. Thanks
i have similar issue however applicationId and id is matching. i am using mac.
i am able to tns run ios. However, when I tried to run tns run android, it got stuck at following and it didn't open anything
Total time: 5.543 secs
Project successfully built.
Installing...
when I stop it then it showed me following lines at terminal
Successfully installed on device with identifier 'emulator-5554'.
Terminated: 15
Successfully transferred all files
Refreshing application...
TypeScript compiler failed with exit code null
I have mac, I have install all nece
ssary steps from nativestcript
@kush99993s did u find a solution to your problem? The same thing is happening with me
I have similar issue as well. App is launch first time and I closed app and want to start again then it shows error like
'WARNING: The Application identifier is different from the one inside 'package.js
on' file.
NativeScript CLI might not work properly.
Update the application identifier in package.json and app.gradle so that they ma
tch.
Project successfully built.
Installing...
Unable to apply changes on device: emulator-5584. Error is: The parser encounter
ed a bad or missing package name in the manifest..'
Even I didn't change anything
Thanks
Thanks @NickIliev for your great answer!
_A little update two years later_
With tns-android version 5.1.0, if we want to update the application id of our nativescript project, we have to change these values :
package.json
"nativescript": {
"id": "your.custom.app.identifier",
"tns-android": {
"version": "5.1.0"
}
}
App_Resources/Android/app.gradle
android {
defaultConfig {
generatedDensities = []
applicationId = "your.custom.app.identifier"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
App_Resources/Android/settings.json _Optional (only if exists)_
{"appId":"your.custom.app.identifier","minSdkVersion":null,"targetSdkVersion":null}
Then remove platforms folder and execute tns platform add android
Most helpful comment
Hello @sunny061
The thing is that when you changed your nativescript id in _package.json_ the app is building with the new id and is deployed on the emulator with that id. However, in the same time the NativeScript CLI is trying to launch the app with the id located in app.gradle.(which at this time is still the old one.)
Steps to resolve:
In your _package.json_ if you have
then go to _app/App_Resources/Android/app.gradle_ and change applicationId value
Then remove the platforms folder, rebuild and your app will be deployed and launched successfully on your emulator/device.