无法识别 assembleDebug(Android Studio 2.2,Gradle 插件 2.2)
assembleDebug isn't recognized (Android Studio 2.2, Gradle plugin 2.2)
直到最新的 Android Studio 和 Gradle 插件更新(均为 2.2)此代码在构建库之前清理了我的输出文件夹,然后将最终存档复制到它。现在它失败并出现错误 "Could not get unknown property 'assembleDebug' for project ':Tools' of type org.gradle.api.Project."
有几个类似但不相同的问题,我在发帖前确实看过了。
是否有任何解决方法、解决方法或完全不同的方法来完成我想要它做的事情?
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
}
task cleanBuildDirAndOut(type: Delete) {
delete buildDir
delete '../OUT/tools.aar'
doLast {
println ('Deleted Tools buildDir')
println ('Deleted tools.aar')
}
}
task copyLibDebug(type: Copy) {
from 'build/outputs/aar/Tools-debug.aar'
into '../OUT'
rename ('Tools-debug.aar', 'tools.aar')
doLast {
println ('Copied tools.aar (debug) to Out')
}
}
assembleDebug.dependsOn copyLibDebug
preBuild.dependsOn cleanBuildDirAndOut
这没有解决无法识别 assembleDebug 的问题,但它解决了我如何在构建后执行任务的问题
gradle.buildFinished {
copyLibDebug.execute()
}
从 Gradle 2.2 开始,您需要将 assembleDebug
和 assembleRelease
(如果有)放入 afterEvaluate
块中。参见 https://code.google.com/p/android/issues/detail?id=219732#c32。
直到最新的 Android Studio 和 Gradle 插件更新(均为 2.2)此代码在构建库之前清理了我的输出文件夹,然后将最终存档复制到它。现在它失败并出现错误 "Could not get unknown property 'assembleDebug' for project ':Tools' of type org.gradle.api.Project."
有几个类似但不相同的问题,我在发帖前确实看过了。
是否有任何解决方法、解决方法或完全不同的方法来完成我想要它做的事情?
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
}
task cleanBuildDirAndOut(type: Delete) {
delete buildDir
delete '../OUT/tools.aar'
doLast {
println ('Deleted Tools buildDir')
println ('Deleted tools.aar')
}
}
task copyLibDebug(type: Copy) {
from 'build/outputs/aar/Tools-debug.aar'
into '../OUT'
rename ('Tools-debug.aar', 'tools.aar')
doLast {
println ('Copied tools.aar (debug) to Out')
}
}
assembleDebug.dependsOn copyLibDebug
preBuild.dependsOn cleanBuildDirAndOut
这没有解决无法识别 assembleDebug 的问题,但它解决了我如何在构建后执行任务的问题
gradle.buildFinished {
copyLibDebug.execute()
}
从 Gradle 2.2 开始,您需要将 assembleDebug
和 assembleRelease
(如果有)放入 afterEvaluate
块中。参见 https://code.google.com/p/android/issues/detail?id=219732#c32。