我正在尝试使用 gradle 压缩一个 android 源,但我的 gradle 任务没有做任何事情。完成 gradle 同步后,什么也没发生,我的源没有压缩。
我遵循了这个但没有工作。
我的摇篮:
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 脚本,请建议我一些解决方案。