IT박스

React native : Android 프로젝트를 찾을 수 없습니다.

itboxs 2020. 10. 16. 07:17
반응형

React native : Android 프로젝트를 찾을 수 없습니다. 반응 네이티브 Android를 먼저 실행 하시겠습니까?


이전에 잘 작동하던 React-Native 프로젝트에 문제가 있었지만 갑자기 작동이 중지되었습니다. 명령을 사용할 때마다 :

react-native run-android

나는 점점 한 오류를 :

Android 프로젝트를 찾을 수 없습니다. 반응 네이티브 Android를 먼저 실행 하시겠습니까?

나는 달리기를 시도했다 .

react-native android

그러나 그것은 말했다 :

Unrecognized command 'android' Run react-native --help to see list of all available commands

시도 후 :

D:\ProjectRoot\ReactNativeProjects\AwesomeProject>react-native eject

반환 된 오류는 다음과 같습니다.

D : \ ProjectRoot \ ReactNativeProjects \ AwesomeProject \ node_modules (48ms)에서 심볼릭 링크 폴더 스캔 프로젝트 이름을 정의하려면 구성 파일 name에서 을 정의해야합니다 app.json. 공백이나 대시를 포함하지 않아야합니다.

다음은 app.json 파일입니다.

{
  "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": [
      "**/*"
    ]
  }
}

나는이 질문을 제기하고 비슷한 문제에 직면 한 다른 사람들에게 도움이 될 것이라고 생각하면서 스스로 대답했습니다. 터미널에 표시된 오류가 정확하지 않았기 때문에 그 뒤에 진짜 이유를 찾기 위해 많은 노력을 기울였습니다.

문제를 해결하려면 react-native 패키지를 업그레이드하세요.

  1. 프로젝트 루트로 이동 합니다 .
  2. 다음 을 입력 하여 명령 프롬프트 에서 React 네이티브 패키지를 업그레이드합니다 .

    react-native upgrade.

  3. 다음을 입력하여 모든 파일을 업데이트 수락 y (Yes)에서 명령 프롬프트 .

참조 : https://github.com/facebook/react-native/issues/9312


나는 그것이 오래된 질문이라는 것을 알고 있지만 그러한 해결책 중 어느 것도 저에게 효과가 없었으며 아마도 저와 같은 다른 사람들이있을 것입니다. 전에이 명령을 실행하는 문제를 해결했습니다.run-android

react-native eject

나는 이렇게했다 ... 일했다 !!

  1. In the CMD Project root run react-native upgrade.
  2. if you are still getting issues, make sure you have react-native in dependencies json in package.json, add it if not
  3. if you are still getting issues, get the version of react native in cmd using react-native -v and check if the value returned in cmd and package.json are same. update the package.json with the value returned in cmd

Here my problem solved.


In the latest version of react-native this suggestion comes when you try to issue the command:

react-native eject

Scanning folders for symlinks in D:\ProjectRoot\ReactNativeProjects\AwesomeProject\node_modules (48ms) App name must be defined in the app.json config file to define the project name. It must not contain any spaces or dashes.

Now when you issue the following command:

D:\ProjectRoot\ReactNativeProjects\AwesomeProject>react-native upgrade

The following shows up:

Scanning folders for symlinks in D:\ProjectRoot\ReactNativeProjects\AwesomeProject\node_modules (56ms) You should consider using the new upgrade tool based on Git. It makes upgrades easier by resolving most conflicts automatically. To use it: - 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 react-native version in "package.json" doesn't match the installed version in "node_modules". Try running "npm install" to fix this. Aborting.

In the Facebook react-native commands suggestions, there is a clear solution.

These commands check the current version and whether there is update needed or not.

Please also see:

Solution to "Expo : cannot find a module LogReporter"


We had this issue because files from android folder gradlew and gradlew.bat (Gradle startup script for the UN*X, Windows respectively) somehow got into the global .gitignore file, and so were not presented on local environments.

Actually running react-native upgrade command restore those files, thus fixing the problem.


As a complement, in the case react-native command is not found, you should install react-native CLI:

npm install -g react-native-cli

Then you can follow the steps people said above.

More details: react-native: command not found


My working solution is below, none of the above worked for me:

CD into your project folder and type expo start --android.

Or the long way:

  1. Open AVD manager in Android Studio and run a virtual device (you can close AS afterwards)
  2. CMD into your project folder and type 'expo start'
  3. Once Expo has started choose option 2 which is "Press a for Android emulator"

It will install expo on the virtual device and you can test from there


When I ran react-native eject, I got this error:

Both the iOS and Android folders already exist! Please delete `ios` and/or `android` before ejecting.
  • Delete the MyProject/android folder.
  • Run react-native eject This generated the android folder

  • Then run react-native run-android to build android


You should consider using the new upgrade tool based on Git. It makes upgrades easier by resolving most conflicts automatically. To use it: - 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

참고URL : https://stackoverflow.com/questions/43723958/react-native-android-project-not-found-maybe-run-react-native-android-first

반응형