How to change Android React Native project name

I need to change the name of my Android project React Native. I changed myapp/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.[new name here]">

but when I try to create an apk release, I get the following error

:app:compileReleaseJavaWithJavac
/Users/harrymoreno/programming/contactsPro/android/app/src/main/java/com/contactspro/MainActivity.java:34: error: cannot find symbol
            .setUseDeveloperSupport(BuildConfig.DEBUG)
                                    ^
  symbol:   variable BuildConfig
  location: class MainActivity
1 error
:app:compileReleaseJavaWithJavac FAILED
+4
source share
2 answers

I solved this by searching the entire project for instances of the old project name using ripgrep and replacing the string in some places (do not try to list the lines of the lines). To change the name of the application, you must edit at least 4 files.

  • android/app/src/main/AndroidManifest.xml
  • android/app/src/main/PATH/TO/JAVA/FILES/MainActivity.java
  • android/app/src/main/PATH/TO/JAVA/FILES/MainApplication.java
  • /android/app/build.gradle

for example, in /android/app/build.gradle

android {
 buildToolsVersion "23.0.1"

 defaultConfig {
     applicationId "com.[change name]"
     minSdkVersion 16
     targetSdkVersion 22
     versionCode 2

/android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.[change name]">

/android/app/src/main/java/com/contactspro/MainActivity.java

package com.[change name];
+15
source

, response-native , .

, .

0

Source: https://habr.com/ru/post/1623679/


All Articles