最近,我决定在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'
}我想再次说明,这与NDK的新实验Gradle相关。我目前使用的是Android Studio 1.4,使用的是Gradle 2.5。
谢谢您一直鼓励我
发布于 2016-02-04 16:47:01
使用compileTask而不是预构建
这对我很管用。
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(changeNamespace)
}https://stackoverflow.com/questions/33191251
复制相似问题