1
最近我决定把Android Studio中新NDK插件兜风预生成依赖于Android工作室
需要解释here
我的build.gradle被成功移植的变化。今天,我决定我需要一个复制任务,以便将文件复制到我的“资产”文件夹中。
网上搜索说我必须使用“preBuild.dependsOn TASKNAME”行,我确信工程确定为正常的摇篮,但在新的实验之一发生故障(在推出“样板”的行为)
现在我的build.gradle失败。
Error:(25, 0) Could not find property 'preBuild' on root project 'Android'.
我相信,任务正确定义,因为错误来自于预生成...线
这里是我的build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.model.application'
task copyWebViewAssets(type: Copy){
from '../Common/WebView'
into 'src/main/assets'
include('**/*')
}
preBuild.dependsOn copyWebViewAssets
model {
compileOptions.with {
sourceCompatibility=JavaVersion.VERSION_1_7
targetCompatibility=JavaVersion.VERSION_1_7
}
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
defaultConfig.with {
applicationId = "com.company.product"
minSdkVersion.apiLevel = 9
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = "1.0"
}
}
android.ndk {
moduleName = "native"
}
android.buildTypes {
release {
minifyEnabled = false
}
debug {
ndk.with {
debuggable = true
}
}
}
android.productFlavors {
// To include all cpu architectures, leaves abiFilters empty
create("all")
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
}
我想再次强调这与新的NDK实验Gradle有关。我目前在Android Studio 1.4上使用Gradle 2.5。
感谢您的支持
我得到一个错误:'没有这样的属性:compileTask类:org.gradle.model.ModelMap' –
为我工作。我用这个建议替换了我的'prebuild.dependsOn'行。谢谢。 – Martin