Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nativescript tns run android (application is not running on device)

When i do tns run ios, all is fine but tns run android just gives me error like this. I tried both device and emulator but the same result.


i have done:

  • reinstall platforms,node_module,hooks. tns doctor has no error done
  • clearing cache on webstorm(android studio project has no problem
  • running) created new {N} file with tns create but same error occured
  • putting 'applicationId = "org.nativescript.fagck_app"' on my
  • app.gradle file. restarted PC/adb multiple times. ran `tns debug
  • android --debug-brk` but still same error occured
  • reinstall brew jdk8

error code:

Installing on device 2744b499...
Successfully installed on device with identifier '2744b499'.
Application org.nativescript.fagck_app is not running on device 2744b499.
This issue may be caused by:
        * crash at startup (try `tns debug android --debug-brk` to check why it crashes)
        * different application identifier in your package.json and in your gradle files (check your identifier in `package.json` and in all *.gradle files in your App_Resources directory)
        * device is locked
        * manual closing of the application
Unable to apply changes on device: 2744b499. Error is: Application org.nativescript.fagck_app is not running.
like image 290
kurt estacion Avatar asked Aug 06 '20 19:08

kurt estacion


2 Answers

The problem for me was that the Application id was different in both:

package.json

}
  ...
    "nativescript": {
    "id": "org.nativescript.myApp"
  }
}

And nativescript.config.ts

export default {
  id: 'org.nativescript.myApp',
  appResourcesPath: 'App_Resources',
  android: {
    v8Flags: '--expose_gc',
    markingMode: 'none'
  }
} as NativeScriptConfig;

It must be the same. After that, it works just fine.

like image 128
silver daymon Avatar answered Oct 13 '22 01:10

silver daymon


Try this commands while your cable is connected to your phone:

  1. adb kill-server
  2. sudo adb start-server
  3. sudo adb reconnect

then retry running NativeScript command.

like image 37
saeed asalisaf Avatar answered Oct 13 '22 03:10

saeed asalisaf