bamlab / react-native-make

A collection of everyday React Native CLI tools
MIT License
761 stars 87 forks source link

error Android project not found. #69

Open jasontumusiime opened 3 years ago

jasontumusiime commented 3 years ago

When I used this package, my main AndroidManifest.xml was modified and the opening <Application> tag was deleted so I kept on getting the following error on $npx react-native run-android:

error Android project not found. Are you sure this is a React Native project? If your Android files are located in a non-standard location (e.g. not inside 'android' folder), consider setting 'project.android.sourceDir' option to point to a new location. Run CLI with --verbose flag for more details.

I tried $npx react-native upgrade as a suggested solution and it too failed with the following error:

error Unexpected close tag
Line: 30
Column: 16
Char: >. Run CLI with --verbose flag for more details.
Error: Unexpected close tag
Line: 30
Column: 16
Char: >
    at error (/.../node_modules/sax/lib/sax.js:651:10)
    at strictFail (/.../node_modules/sax/lib/sax.js:677:7)

I had to revert using git to fix the lost <application...> tag.

react-native: ~0.63.4, react-native-make: 3.0.3

Thank you.

JasmineCA commented 3 years ago

I got the same issue with an expo project ejected to react native and using "react-native set-icon --platform android"

mariansam commented 3 years ago

I'm also using a bare Expo project and the Android manifest file got corrupted.

Solution

When your Android manifest got corrupted:

  1. git restore --staged android/app/src/main/AndroidManifest.xml (this unstages the file from git)
  2. git checkout android/app/src/main/AndroidManifest.xml (this puts the file to its original state)