简体   繁体   中英

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.

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.

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.

try with changing the application ID to "com.example.myapp" where example is your domain name.

In may case, i have installed a software in my mac that also runs adb. The main prob really was its conflicting with the android adb. uninstall that software solved the problem

I faced the same problem:

>>> ns run android
(...)
Project successfully built.
The build result is located at: /Users/krzysztof/dev/surfcloud-mobile-apps/bizApp/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Installing on device ce12171cd1a920bd0d...
Successfully installed on device with identifier 'ce12171cd1a920bd0d'.
Application app.surfcloud.bizApp is not running on device ce12171cd1a920bd0d.
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: ce12171cd1a920bd0d. Error is: Application app.surfcloud.bizApp is not running.

In my case the solution was to change:

<activity android:exported="false" (...)/>

to:

<activity android:exported="true" (...)/>

in AndroidManifest.xml . After setting exported to true the app launches normally.

in my case, this did not work due to an overflow of the device's memory. Clean memory and try install again

For me, it was just that I had a previous version of the app already installed on the device. Uninstalling that fixed the problem.

In my case, I ran out of disk space on my phone... tns showed it connected to my phone and starting to install it, but then crashed with the same msg as above.

So I've started to remove apps and pictures, and it's just worked.

Because that error appeared on a brand new project (w/o any changes) and also to an app that was already done and I know it was working as it was installed already on my phone...

  • Check if Application id is same in package.json and androidMenifest.xml
  • If looks good then open android studio: Tools > AVD Manager > Wipe Data of existing device.
  • Restart the application: tns run android.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM