react-native配置根项目时发生问题

时间:2019-07-20 18:24:18

标签: react-native

我是React Native开发的新手。我正在尝试建立一个APK。但是我遇到了错误。

我已经运行了命令“ react-native run-android”

下面是我的项目的Android文件夹结构中的build.gradle文件

  buildscript {
     repositories {
        jcenter()
      }
     dependencies {
       classpath 'com.android.tools.build:gradle:2.2.3'
       classpath 'com.google.gms:google-services:3.1.0'
       classpath 'com.android.support:multidex:1.0.0'

       // NOTE: Do not place your application dependencies here; they 
             belong
        // in the individual module build.gradle files
     }
   }

    allprojects {
        repositories {

          mavenLocal()
          jcenter()
          maven {
            url 'https://maven.google.com'
            // All of React Native (JS, Obj-C sources, Android binaries) 
             is 
            installed from npm
            url "$rootDir/../node_modules/react-native/android"
         }
      }
    }

这是我在运行“ react-native run-android”命令时收到的错误消息。

 PS D:\App\Front_End> react-native run-android                                                                            
 warn Package <dependency> has been ignored because it contains invalid 
 configuration. Reason: Cannot find module '<dependency>\package.json'
 warn The following packages use deprecated "rnpm" config that will stop 
 working from next release:
 - native-base: https://github.com/GeekyAnts/NativeBase#readme
 - react-native-code-push: https://microsoft.github.io/code-push
 - react-native-google-analytics-bridge: https://github.com/idehub/react- 
   native-google-analytics-bridge#readme
 - react-native-push-notification: https://github.com/zo0r/react-native- 
   push-notification#readme
 - react-native-sqlite-storage: https://github.com/andpor/react-native- 
   sqlite-storage
  Please notify their maintainers about it. You can find more details at 
  https://github.com/react-native- 
  community/cli/blob/master/docs/configuration.md#migration-guide.
  error React Native CLI uses autolinking for native dependencies, but 
  the following modules are linked manually:
- react-native-code-push (to unlink run: "react-native unlink react- 
  native-code-push")
- react-native-contacts (to unlink run: "react-native unlink react- 
  native-contacts")
- react-native-fs (to unlink run: "react-native unlink react-native-fs")
- react-native-push-notification (to unlink run: "react-native unlink 
  react-native-push-notification")
This is likely happening when upgrading React Native from below 0.60 to 
0.60 or above. Going forward, you can unlink this dependency via "react- 
native unlink <dependency>" and it will be included in your app 
automatically. If a library isn't compatible with autolinking, disregard 
this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native- 
community/cli/blob/master/docs/autolinking.md
info Running jetifier to migrate libraries to AndroidX. You can disable 
it using "--no-jetifier" flag.
Jetifier found 1137 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...

BUILD FAILED

 Total time: 1 mins 39.096 secs

 FAILURE: Build failed with an exception.

 * What went wrong:
 A problem occurred configuring root project 'TestProject'.
  > Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.android.support:multidex:1.0.0.
    Searched in the following locations:

 https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex- 
 1.0.0.pom

 https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex- 
 1.0.0.jar
   Required by:
     :YoungClay:unspecified

 * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or - 
-debug option to get more log output.

 error Failed to install the app. Make sure you have the Android 
 development environment set up: https://facebook.github.io/react- 
 native/docs/getting-started.html#android-development-environment. Run 
 CLI with --verbose flag for more details.
 Error: Command failed: gradlew.bat app:installDebug - 
 PreactNativeDevServerPort=8081

 FAILURE: Build failed with an exception.

 * What went wrong:
   A problem occurred configuring root project 'TestProject'.
    > Could not resolve all dependencies for configuration ':classpath'.
     > Could not find com.android.support:multidex:1.0.0.
      Searched in the following locations:


 https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex- 
 1.0.0.pom


 https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex- 
 1.0.0.jar
 Required by:
     :TestProject:unspecified

* Try:
  Run with --stacktrace option to get the stack trace. Run with --info or 
 --debug option to get more log output.

at checkExecSyncError (child_process.js:637:11)
at execFileSync (child_process.js:655:13)
at runOnAllDevices (D:\App\Front_End\node_modules\@react-native- 
   community\cli-platform- 
   android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (D:\App\Front_End\node_modules\@react-native- 
  community\cli-platform- 
  android\build\commands\runAndroid\index.js:169:41)
at then.result (D:\App\Front_End\node_modules\@react-native- 
  community\cli-platform- 
  android\build\commands\runAndroid\index.js:135:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)

0 个答案:

没有答案