react-native-rename
react-native-rename copied to clipboard
Android files has been removed
I noticed that my android files has been removed.
android/app/src/debug/java/com/appsocio/ReactNativeFlipper.java android/app/src/main/java/com/appsocio/MainActivity.java android/app/src/main/java/com/appsocio/MainApplication.java android/app/src/main/java/com/appsocio/generated/BasePackageList.java
Project created with Expo Bare workflow. Using latest version of this package.
Old BundleId = "com.appsocio" New BundleId = "com.qualitysys.0009"
Does anyone know why?
I've done some tests. I think the problem is because "git mv -k" is not copiyng files, but only folders.
When i try to execute the git mv command mannualy, simulating the program, i've got this message:
git mv "android/app/src/main/java/com/appsocio/"* "android/app/src/main/java/com/qualitysys/0009" fatal: bad source, source=android/app/src/main/java/com/appsocio/*, destination=android/app/src/main/java/com/qualitysys/0009/*
My git version is 2.31.1.windows.1
I found the problem.
You are using git mv -k, which doesn't return any error.
My folder is under a git repository, so this condition is not valid in my case:
gitMove.code === 128
This error code is wrong in my case, because 128 is not bad source error code. I didn't found the correctly error code for 'bad source', but if someone else find it, just release a new version with the correctly code.
The solution might be:
const gitMove = shell.exec(`git mv "${fullCurrentBundlePath}/"* "${fullNewBundlePath}"`);
const successMsg = `${newBundlePath} ${colors.green('BUNDLE IDENTIFIER CHANGED')}`;
if (gitMove.code === 0) {
console.log(successMsg);
} else {
const shellMove = shell.mv('-f', fullCurrentBundlePath + '/*', fullNewBundlePath);
// if "outside repository" error occured
if (shellMove.code === 0) {
console.log(successMsg);
} else {
console.log(`Error moving: "${currentJavaPath}" "${newBundlePath}"`);
}
}
same here
@duduccosta can u help me?
@duduccosta thank u https://github.com/duduccosta/react-native-rename
I have removed using a git for moving files as it leads to bugs. Now after moving, we run git add .
Please use the latest version v2.9.0
and let me know if the fix works for you.
@duduccosta Btw you have a invalid bundle id
https://developer.android.com/studio/build/application-id
This bug is still present on 2.9.0 @vomchik
Same happened to me while running npx react-native-rename newname -b com.newname.newnameAndsomething
(uppercase in the middle of the third word + two dots) with 2.9.0.
Also, I already had moved the files listed in the original post to a correct path (from android/app/build/src/main/com/oldname
to android/app/build/src/main/com/newname/Andsomethingelse
).
Closing, please check v3.