Gradle构建异常:任务':app:packageRelease'的执行失败

时间:2020-10-10 17:06:37

标签: build.gradle

当我使用GitHub动作构建APK时,遇到以下错误 执行任务失败

':app:packageRelease'
    java.util.zip.ZipException: invalid code lengths set 

我尝试重建它,但是没有用。 自上次成功构建以来,我仅修改了Java和XML文件,从未更改过build.gradle代码。 我还尝试通过信息打印详细的构建日志,但是异常日志仍然只有上面两行。 我不知道该怎么办。请帮助我。

这是我的build.gradle文件

ext {
    VersionName = '3.1.6.2'
    VersionCode = 200914
    }
    apply plugin: 'com.android.application'
    android {
    packagingOptions{
        exclude 'META-INF/androidx.vectordrawable_vectordrawable.version'
    }
    
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    
    defaultConfig {
        applicationId "com.mytest"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode VersionCode
        versionName VersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        flavorDimensions "channel"
    }
    buildTypes {
        release {
            zipAlignEnabled true
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            versionNameSuffix = '(Dev)'
            debuggable = true
        }
    }
    buildFeatures {
        dataBinding true
    }
    
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'org.jsoup:jsoup:1.13.1'
    implementation 'com.oasisfeng.condom:library:2.5.0'
    //implementation 'com.ifreedomer:com.ifreedomer.permissionhelper:1.0.7'
    implementation 'com.zhy:okhttputils:2.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    //noinspection GradleDependency
    implementation 'com.umeng.umsdk:analytics:8.1.6'
    implementation 'com.umeng.umsdk:common:2.2.5'
    implementation 'com.blankj:utilcodex:1.26.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.viewpager:viewpager:1.0.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    //implementation 'org.adblockplus:adblock-android-settings:3.0'
    //implementation 'org.adblockplus:adblock-android-webview:3.0'
    implementation 'com.shuyu:gsyVideoPlayer-java:7.1.3'
    implementation 'com.google.android.material:material:1.2.0'
    implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
    implementation "androidx.documentfile:documentfile:1.0.1"
    //implementation 'com.shuyu:gsyVideoPlayer-arm64:7.1.3'
    //implementation project(':hooklib')
    //implementation project(':xposedcompat')


}

这是另一个build.gradle文件

ext {
    VersionCode = 200319
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/umsdk/release' }
        maven {
            url "https://jitpack.io"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
        //classpath 'com.android.tools.build:gradle:4.0.1'
        //classpath 'com.novoda:bintray-release:0.9.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/umsdk/release' }

        maven {
            url "https://jitpack.io"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

此外,尽管我的build.gradle指定的gradle版本是4.0.1,但是在GitHub中运行的实际版本是6.1.1

0 个答案:

没有答案