[RESOLVED] Build error after change package id from package.json


#1

Steps to reproduce:

  • execute $ tns create my-app --template tns-template-hello-world-ts
  • cd my-app
  • tns run android

All works well!

Then:

  • Open “package.json” from the project root.
  • Replace package id by: { “id”: “my.new.package.id” … }
  • tns run android

Build error (Copied at the end of this message).

Note:

  • Nativescript and all dependencies are updated to latest version.
  • Emulator: Nexus 5X API 26.

I tried:

  • Removing and adding Android platform.
  • Unninstalling the app from the Emulator.
  • Cleaning NPM cache.
  • Reinstalling nativescript -g and local.
  • Creating a new project and reproducing above steps.

Some idea to solve it?
Thanks.

Running full build
finished with reading lines with js files
D:\_Recursos\parnative2\platforms\android\build\generated\source\r\F0\debug\ar\c
om\parvisual\native\R.java:8: error: <identifier> expected
package my.new.package.id;
                         ^
D:\_Recursos\parnative2\platforms\android\build\generated\source\buildConfig\F0\
debug\ar\com\parvisual\native\BuildConfig.java:4: error: <identifier> expected
package my.new.package.id;
                         ^
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileF0DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

#2

‘package’ is a reserved keyword in Java, I am not sure about new, but you may have troubles with that one as well.


#3

That’s right! To prevent this kind of error you shouldn’t use words like “package”, “app”, “native”, etc in your package id.

Thanks Pete! :smiley: