【发布时间】:2018-02-09 16:33:07
【问题描述】:
我正在尝试使用 gradle 压缩一个 android 源代码,但我的 gradle 任务没有做任何事情。完成 gradle 同步后,什么也没发生,我的源没有压缩。
我关注了this,但没有成功。
我的摇篮:
apply plugin: 'com.android.application'
task myZip(type: Zip) {
from 'src/main/assets/'
include '*/*'
archiveName 'test.zip'
destinationDir(file('src/main/'))
println "Zipping Continues... "
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "test.sample.com.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.0.2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
这是我的 gradle 脚本,请给我一些解决方案。
【问题讨论】:
-
是的,我试过了,但没用,请帮帮我
-
是的,我试过了,但没有用,你能建议我一些解决方案吗?
-
上述问题的解决方案对我有用。但也许你需要真正触发你的任务 myZip 而不仅仅是刷新 Gradle?因为我需要手动触发我的 zip 任务。
标签: android android-gradle-plugin zip gradle-task