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


Steps to reproduce:

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

All works well!


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


  • 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?

Running full build
finished with reading lines with js files
om\parvisual\native\R.java:8: error: <identifier> expected
package my.new.package.id;
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.


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


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: