Skip to content

App not launching in device using command "tns run android" #2092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bilalsoomro opened this issue Oct 5, 2016 · 8 comments
Closed

App not launching in device using command "tns run android" #2092

bilalsoomro opened this issue Oct 5, 2016 · 8 comments
Assignees
Labels

Comments

@bilalsoomro
Copy link

bilalsoomro commented Oct 5, 2016

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

@NickIliev NickIliev self-assigned this Oct 5, 2016
@NickIliev
Copy link
Contributor

NickIliev commented Oct 5, 2016

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.

@bilalsoomro
Copy link
Author

Just tried it and it works as expected. Thanks

@kush99993s
Copy link

kush99993s commented Jul 4, 2017

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

@TitikshaDaga
Copy link

TitikshaDaga commented Sep 6, 2017

@kush99993s did u find a solution to your problem? The same thing is happening with me

@dhananjaykumar880
Copy link

dhananjaykumar880 commented Oct 4, 2017

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

@silentzone
Copy link

Thanks

@cverons
Copy link

cverons commented Dec 22, 2018

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

@SeanKelly369
Copy link

This solved the problem for me also. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants