react-native编译错误:SDK Build Tools版本对于项目来说太低了

时间:2017-08-31 14:54:16

标签: android react-native

这是使用react-native

我不熟悉编译,所以欢迎任何帮助。

今天我无法编译我的项目,我正在研究它,因为很多小时和编译,我尝试更新反应包,但得到一个错误。所以我用git stash(rollback)存储项目并获取以前的工作文件。我重新安装node_modules但出现问题。我尝试几个小时更改文件中的版本,重新安装包

  >react-native run-android 
  ...
  What went wrong:
   A problem occurred configuring project ':app'.
  > Could not resolve all dependencies for configuration ':app:_debugApk'.
     > A problem occurred configuring project ':react-native-image-crop-picker'.
          > The SDK Build Tools revision (23.0.3) is too low for project ':react-native-image-crop-picker'. Minimum required is 25.0.0

/myProject/android/build.gradle

buildscript {
    repositories {          jcenter()       }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
} ...

/myProject/android/app/build.gradle

 apply plugin: "com.android.application"
 ...
android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.iosreacttestplantnet2"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        vectorDrawables.useSupportLibrary = true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    } 
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-vector-icons')
    compile project(':react-native-maps')
    compile project(':react-native-camera')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-exif')
    compile project(':react-native-photo-view')
    compile project(':react-native-i18n')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
} 
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

MyProject的/机器人/应用程序/ SRC /主

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.iosreacttestplantnet2"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="22" />

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme">
      <meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="AIzaSyCGUcCxkCNyU9WBVYcGoTUexD-Xwlo2U4Q"/>
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

myProject的/的package.json

  "react-native-image-crop-picker": "^0.14.2",

1 个答案:

答案 0 :(得分:1)

您可以在react-native-image-crop-picker中的compileSdkVersion文件的git历史记录中看到targetSdkVersion&amp; 23已于6月23日从25更改为react-native-image-crop-picker,因此您需要下载相应的Android SDK才能使<div class="red" id="red" > some content</div> document.getElementById('red').style.width="100px"; 正常工作。