Rename appliaction package name - Not able to compile #22967
Labels
Bug
DX
Issues concerning how the developer experience can be improved.
Resolution: Locked
This issue was locked by the bot.
Environment
React Native Environment Info:
System:
OS: macOS 10.14.1
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 32.00 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.13.0 - /usr/local/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 25, 27
Build Tools: 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-27 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-rename: 2.4.0
Description
The problem I am facing is to rename the react native android application name. I have tried to solve this problem multiple times with different solutions, however, I am still not able to solve this problem. So, I decided to rebuild my problem in a new project to see if I still get the same error and the result is I get exactly the same error.
I even tried to use the [npm rename package][1] to set the package name by the plugin however, even this is producing exactly the same error!
Reproducible Demo
react-native init MyAwesomeProject
.com.myawesomeproject
withcom.awesome.project
in the following files:/android/app/BUCK:
android/app/src/main/AndroidManifest.xml
android/app/build.gradle
Replace
package com.myawesomeproject;
withpackage com.awesome.project;
and moved theMainActivity.java
andMainApplication.java
file fromandroid/app/src/main/java/com/myawesomeproject/
to the new pathandroid/app/src/main/java/com/awesome/myawesomeproject/
.Run
cd android && ./gradlew clean && cd ..
Run the android application
react-native run-android
This should be the output (I get the exact same error I am facing in my actual project):
You can see, React tried to compile the wrong files. It is accessing the old path:
android/app/src/main/java/com/myawesomeproject/...
instead of the new (package name) one we set:
android/app/src/main/java/com/awesome/project/...
Comment
I have to add that somehow I have achieved to rename the android application name and it got installed on my android emulator. But the app didn't open up. I always got " has stopped". I got this error also with the new and clean initialized react native project. Sadly I cannot remember how to reproduce this error after all the different solutions I tried out..
The text was updated successfully, but these errors were encountered: