Generated Signed Bundle / APK-Lint在组装发布目标时发现致命错误

问题描述 投票:1回答:1

我正在尝试生成签名的apk,但是出现以下错误:

Lint found fatal errors while assembling a release target.

To proceed, either fix the issues identified by lint or modify your build script as follows:
...
android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
...

因此,我开始研究如何解决此问题,并对此question提出了质疑,并找到了一些有用的信息。

实际上,..\app\build\reports\中有一个名为\lint-results-release-fatal.html的文件包含错误原因:

Duplicate Platform Classes
../../build.gradle: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or `okhttp` instead), or repackaging the library using something like jarjar.
../../build.gradle: `httpclient` defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for `httpclient` use HttpUrlConnection or `okhttp` instead), or repackaging the library using something like jarjar.

对不起,如果阅读可能很无聊,但我正尝试逐步解释...

所以我一直在寻找,直到被卡在question上为止。基本上建议是添加这两行代码以排除重复的类:

configurations {
    all {
        exclude module: 'httpclient'
        exclude module: 'commons-logging'
    }
}

[不幸的是,有一个问题,当我再次编译应用程序时,出现了我无法解决的错误:

error: cannot access ContentType
class file for org.apache.http.entity.ContentType not found

我真的认为排除了httpclient模块和上面报告的错误,但是我可能错了...

这些是一些有用的信息:

Android Studio 3.5.1
Build #AI-191.8026.42.35.5900203, built on September 25, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

再次感谢您阅读这里,欢迎您提出解决方案或建议!

14:54 05/11/19

添加其他信息,可以使您对情况有更好的了解

compileSdkVersion 28
defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 22
    targetSdkVersion 28
    versionCode 2
    versionName "21.19.08.27"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

[16:35 05/11/2019

这里有依赖项

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview-selection:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'com.google.android.material:material:1.1.0-alpha07'
    implementation 'com.google.code.gson:gson:2.8.5'

    implementation 'com.williamww:silky-signature:0.1.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.1.0'
    implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'
    implementation 'com.weiwangcn.betterspinner:library:1.1.0'

    implementation 'org.apache.httpcomponents:httpmime:4.3.6'

    implementation 'com.ajts.androidmads.sqliteimpex:library:1.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
android android-studio gradle android-gradle-plugin android-studio-3.0
1个回答
0
投票

将其添加到应用程序级别gradle

 buildTypes {
        lintOptions {
            checkReleaseBuilds false
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

© www.soinside.com 2019 - 2024. All rights reserved.