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