After updating the latest version of React native 0.62 i have faced a problem while running react native android project. The error is noted as ” 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. ” This error is mainly comes when we try to install new package in react native project and for some reason the package dose not install properly. To solve this error we have 2 Solutions. We will discus both solutions in current tutorial.
Screenshot of Error message:
Solution 1 :
1. Open your React Native Project Root Directory and locate android -> app -> build -> intermediates -> signing_config -> debug -> out -> signing-config.json .
2. Delete the signing-config.json file and then again GoTo your react native project root directory and run again project using
react—native run—android command. After this your react native project will run successfully.
Solution 2:
1. Sometimes if we have older version of react native and some of newly installed packages dose not support older version. Then you have to update the react native project using
react—native upgrade command.
2. After done updating current project to new version this error should resolved.
Related posts:
When working on React native, if you have seen the “React Native Android Project Not Found”error, you are not alone, there are many developers who are facing the same issue. let see the reason and solution how we can fix it.
When I am using React Native, below error is seen:
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. info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
How to Fix the “React Native Android Project Not Found” Error
To fix the Issue, follow the below Steps:
Step 1: Go to the “node_modules” Folder
Step 2: Find “glob”
Step 3: Open the “common.js” file
Step 4: You would be able to see the below parameters
options.allowWindowsEscape = true
Change the “options.allowWindowsEscape = true” True value to “False”.
It should be able to solve the “React Native Android Project Not Found” Error.
Conclusion
To Solve the “React Native Android Project Not Found” Error, First, Go to the “node_modules” Folder, Find “glob”, Open the “common.js” file, In options.allowWindowsEscape = true parameter, change the value to “False”.
Here, app.json does not have name, but it has expo related config.
So just add name and display name fields in app.json.
app.json (first two lines) :
{
"name": "AwesomeProject",
"displayName": "Awesome Project",
"expo": {
"name": "AwesomeProject",
"description": "A very interesting project.",
"slug": "AwesomeProject",
"privacy": "public",
"sdkVersion": "30.0.0",
"platforms": ["ios", "android"],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.project.first"
},
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
]
}
}
After this, just run :
$ react-native eject
info Generating the iOS folder.
info Generating the Android folder.
No need to do react-native upgrade.
You may encounter this «Android project not found. Maybe run react-native android first» error message when you try to deploy the react-native application to your mobile device. As far as I figured there are two things that you may have to do while doing a fix for this issue.
1. Straight forward solution.
In most of the cases, this will sort out this error by upgrading the react-native package in the root folder.
- Go to the Project Root.
- Upgrade the React native package in the Command Prompt by typing :
react-native upgrade
- Then Accept to update all the Files by typing y (Yes) in the Command Prompt.
2. GIT based upgrade.
You might see another option saying to upgrade git related package as the following message:
«You should consider using the new upgrade tool based on Git. It makes upgrades easier by resolving most conflicts automatically.»
- Go back to the old version of React Native.
- Run
npm install -g react-native-git-upgrade
- Run
react-native-git-upgrade
See https://facebook.github.io/react-native/docs/upgrading.html
Your project needs to have a name, declared in package.json, such as «name»: «AwesomeApp». Please add a project name. Aborting.
После нескольких дней работы с React Native и Android я добавил несколько внешних библиотек, и все было хорошо.
После перезагрузки компьютера я вернулся в корень собственного проекта и набрал
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.
Мой проект Android находится в стандартном месте: MyReactProjectandroid.
Любые идеи, что случилось или как это исправить?
5 ответов
Просто нашел решение. Вам просто нужно перейти в node_modules -> glob -> common.js.
Найдите options.allowWindowsEscape и установите для него значение false.
Это сработало для меня, и также потребовалось 3 часа, чтобы найти решение. Надеюсь, это сработает и для вас.
2
Uzzam Altaf
15 Май 2022 в 00:12
Таким образом, в основном проблема может заключаться в том, что вы можете запустить проект быстрого запуска expo CLI в «React native CLI Quickstart». Есть два пути: — https://reactnative.dev/docs/environment-setup
Проблема может быть решена: — 1) npm install -g expo-cli 2) expo init AwesomeProject
Cd npm start # можно также использовать: expo start
0
Shikhar Thakur
21 Дек 2021 в 15:29
Я нашел решение, которое работает, но до сих пор не знаю, что пошло не так. вероятно, из-за установки новых пакетов.
- Откройте корневой каталог моего проекта React Native.
- перейдите в androidappbuildintermediatessigning_configdebugout
- Удалите файл signing-config.json.
- вернуться в корневой каталог
- введите
npx react-native run-android
Решение основано на этом сайте, надеюсь, это поможет другим.
4
Citizen-Dror
1 Окт 2020 в 11:43
Вы должны проверить свой манифест, я не закрыл тег
3
digital and olé
6 Мар 2021 в 12:50
Убедитесь, что у вас есть папки «android» и «ios» в корневом каталоге вашего проекта точно так, как показано на рисунках ниже. Если у вас нет этих папок, создайте их.
npm i react-native-eject
npm i @react-native-community/cli
react-native eject
react-native upgrade
1
Vega
5 Июн 2021 в 15:39