【发布时间】:2015-10-17 20:25:15
【问题描述】:
最近我决定试一试 Android Studio 中的新 NDK 插件
需要的更改解释here
我的 build.gradle 移植成功。今天我决定我需要一个复制任务才能将文件复制到我的“资产”文件夹中。
在线搜索说我必须使用“preBuild.dependsOn taskName”行,我确信这对于普通 Gradle 可以正常工作,但在新的实验性行中失败(引入了“模型”行为)
现在我的 build.gradle 失败了。
Error:(25, 0) Could not find property 'preBuild' on root project 'Android'.
我确信任务定义正确,因为错误来自 preBuild... 行
这是我的 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'
}
我想再次说明这与新的实验性 Gradle for NDK 有关。我目前在 Android Studio 1.4 上,使用 Gradle 2.5。
感谢您的支持
【问题讨论】:
标签: android gradle android-ndk