windows環境里React-Native運行失敗的原因之一,缺少依賴

  • 2019 年 10 月 6 日
  • 筆記

版權聲明:本文為部落客原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接和本聲明。

本文鏈接:https://jerry.blog.csdn.net/article/details/101168656

命令行react-native run-android遇到如下錯誤:

Could not resolve project :react-native-camera

用下列命令行安裝依賴後問題仍舊存在:

npm install –save react-native-camera

在這裡鏈接里找到了解決方案: https://github.com/react-native-community/react-native-camera/blob/master/docs/migrationV2.md#android

android {      compileSdkVersion rootProject.ext.compileSdkVersion        compileOptions {          sourceCompatibility JavaVersion.VERSION_1_8          targetCompatibility JavaVersion.VERSION_1_8      }        defaultConfig {          applicationId "com.bacardi"          minSdkVersion rootProject.ext.minSdkVersion          targetSdkVersion rootProject.ext.targetSdkVersion          versionCode 1          versionName "1.0"          missingDimensionStrategy 'react-native-camera', 'general'      }      splits {          abi {              reset()              enable enableSeparateBuildPerCPUArchitecture              universalApk false  // If true, also generate a universal APK              include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"          }      }      buildTypes {          release {              minifyEnabled enableProguardInReleaseBuilds              proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"          }      }