0

I'm converting an existing app that was made in ReactNative to Kotlin. We want to update the app at the end and not create a new one.

In order to do that we have to use the same package name but the old dev team named the package: app.something.react.native. When I try to name the package that way II have the following error:

Package 'app.something.react.native' from AndroidManifest.xml is not a valid Java package name as 'native' is a Java keyword.

Is there a way to either make kotlin accepting this package name or change the package name without having to publish it as a new app ? Thanks for your help!

mistralaix
  • 29
  • 1
  • 4
  • in android package name start from 'com' example: 'com.something.react.native' – Sandeep Pareek May 19 '21 at 07:18
  • 3
    native is a reserved keyword in Java. – spi May 19 '21 at 07:21
  • 1
    @SandeepPareek That's blatantly wrong. The "best" practice is widely considered to be prefixing an identifier for the project with a domain name for the entity creating it, but that doesn't mean the package name always has to start with com (or follow that "best" practice). Counter-example: `org.json` – Zoe May 19 '21 at 07:50

1 Answers1

3

'native' is a Java keyword

There is no way to not change the package name when you want to work with java / kotlin. You could just append something like '1' and than use the replace tool to change it in the rest of the app. Also all names with '-' are also invaild.

Marlon
  • 333
  • 2
  • 13