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

10

8

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.
Hod answered 6/8, 2020 at 19:8 Comment(0)
H
1

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

Hod answered 6/8, 2020 at 19:8 Comment(0)
R
9

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.

Rudder answered 23/10, 2020 at 0:19 Comment(1)
This was my issue :SConjunctiva
E
3

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.

Elaterin answered 18/8, 2020 at 21:19 Comment(0)
H
1

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

Hod answered 6/8, 2020 at 19:8 Comment(0)
P
1

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

Pignus answered 8/8, 2020 at 8:27 Comment(0)
T
1

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

Teetotaler answered 22/7, 2021 at 15:53 Comment(0)
D
1

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.

Dellora answered 16/3, 2022 at 15:0 Comment(0)
C
0

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

Crap answered 18/1, 2022 at 4:52 Comment(0)
K
0

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 ...

Kerrin answered 22/3, 2022 at 17:26 Comment(0)
L
0
  • 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.
Landholder answered 17/1, 2023 at 13:55 Comment(0)
U
0

answer from https://stackoverflow.com/users/11142390/silver-daymon is cool, but this is only small parts of truth, because name "com.tns.NativeScriptApplication" hardcoded in gradle scripts and more other places

  \platforms\android\app\build\intermediates\assets\debug\app\vendor.js
  \node_modules\@nativescript\core\application\application.android.js

You can not define name in Manifest you want without changing the same name in other places

hardcoded name

Unreasonable answered 6/6 at 15:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.