我正在使用gradle-experimental:0.7.2来构建我的react-native项目,因为它支持NDK。 但是我收到了这个错误
FAILURE: Build failed with an exception.
* Where:
Script '/Users/username/AwesomeProject/node_modules/react-native/react.gradle' line: 25
* What went wrong:
Could not find property 'android' on project ':app'.
这是我的build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.2'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
apply plugin: "com.android.model.application"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.awesomeproject"
minSdkVersion.apiLevel 16
targetSdkVersion.apiLevel 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
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"
}
}
ndk {
moduleName "elian-wrapper-jni"
ldLibs.add("log")
stl "stlport_static"
}
sources {
main {
jni {
dependencies {
library "elian" linkage "shared"
}
}
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
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
}
}
}
}
repositories {
libs(PrebuiltLibraries) {
elian {
headers.srcDir "src/main/jni"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("src/main/jniLibs/${targetPlatform.getName()}/libelian.a")
}
}
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
我想知道反应原生支持是否使用gradle expiremental插件构建,或者我的gradle设置有错误?
非常感谢!