Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.8.0 version and is up to date.
✔ Component @nativescript/core has 8.8.1 version and is up to date.
✔ Component @nativescript/ios has 8.8.1 version and is up to date.
✔ Component @nativescript/android has 8.8.0 version and is up to date.
Describe the bug
After upgrading my local installation of NS to 8.8.0 and upgrading my project to use @nativescript/android 8.8.0, when running ns run android --emulator I get this output to my console:
webpack 5.92.1 compiled with 1 warning in 37206 ms
Webpack compilation complete. Watching for file changes.
Updating runtime package.json with configuration values...
Project successfully prepared (android)
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Application com.wellsky.resourcemanager is not running on device emulator-5554.
This issue may be caused by:
* crash at startup (try `ns 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: emulator-5554. Error is: Application com.wellsky.resourcemanager is not running.
However, despite the above saying the application is not running on the emulator, it is running and functions correctly.
After looking at the code in https://github.com/NativeScript/android/commit/d4b716427934ebb4387a04842561d5b5d0e1fa3d I see a new computeNamespace function was added that looks suspicious, hard-coding the namespace that's returned to "com.tns.testapplication" when one isn't found. I searched my platforms/android build output dir for "com.tns.testapplication" and find that the package attribute in the AndroidManifest.xml is set to "com.tns.testapplication" rather than the ID I've specified in the nativescript.config.ts file; it should be "com.wellsky.resourcemanager".
I believe the issue is that the computeNamespace function is not handling the case where the "id" is defined under the "android" section in the nativescript.config.ts file rather than at the root. Indeed if I add this "id" field I'm able to work around the problem.
Would "com.tns.testapplication" ever be a correct namespace? It seems if the application ID can't be found the build should error rather than silently putting in a fake namespace.
Is it intentional the file that's parsed and the logic that's used in computeNamespace is different than in the set/getAppIdentifier?
Environment Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project): ✔ Getting NativeScript components versions information... ✔ Component nativescript has 8.8.0 version and is up to date. ✔ Component @nativescript/core has 8.8.1 version and is up to date. ✔ Component @nativescript/ios has 8.8.1 version and is up to date. ✔ Component @nativescript/android has 8.8.0 version and is up to date.Describe the bug
After upgrading my local installation of NS to 8.8.0 and upgrading my project to use @nativescript/android 8.8.0, when running
ns run android --emulator
I get this output to my console:However, despite the above saying the application is not running on the emulator, it is running and functions correctly.
After looking at the code in https://github.com/NativeScript/android/commit/d4b716427934ebb4387a04842561d5b5d0e1fa3d I see a new
computeNamespace
function was added that looks suspicious, hard-coding the namespace that's returned to "com.tns.testapplication" when one isn't found. I searched myplatforms/android
build output dir for "com.tns.testapplication" and find that the package attribute in the AndroidManifest.xml is set to "com.tns.testapplication" rather than the ID I've specified in thenativescript.config.ts
file; it should be "com.wellsky.resourcemanager".I believe the issue is that the
computeNamespace
function is not handling the case where the "id" is defined under the "android" section in the nativescript.config.ts file rather than at the root. Indeed if I add this "id" field I'm able to work around the problem.nativescript.config.ts that exposes the problem
nativescript.config.ts that works around the problem
Additional questions: