react-native-rename icon indicating copy to clipboard operation
react-native-rename copied to clipboard

Android files has been removed

Open duduccosta opened this issue 3 years ago • 8 comments

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?

duduccosta avatar Apr 22 '21 23:04 duduccosta

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

duduccosta avatar Apr 23 '21 00:04 duduccosta

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}"`);
                    }
                  }

duduccosta avatar Apr 23 '21 00:04 duduccosta

same here

joaosouz4dev avatar May 12 '21 15:05 joaosouz4dev

@duduccosta can u help me?

joaosouz4dev avatar May 13 '21 14:05 joaosouz4dev

@duduccosta thank u https://github.com/duduccosta/react-native-rename

joaosouz4dev avatar May 27 '21 14:05 joaosouz4dev

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 image https://developer.android.com/studio/build/application-id

vomchik avatar May 31 '21 19:05 vomchik

This bug is still present on 2.9.0 @vomchik

Nikostito avatar Jun 28 '21 14:06 Nikostito

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

pedenys avatar Sep 08 '21 16:09 pedenys

Closing, please check v3.

junedomingo avatar Dec 26 '22 09:12 junedomingo