组装发行版目标时,opencsv依赖关系导致Lint错误(重复的平台类)

时间:2019-05-22 18:02:54

标签: android android-studio google-play opencsv

我正在努力将我的Android应用程序带入Google Play商店,这需要经过签名的发行版本。在Android Studio中组装发行目标时,opencsv库导致Lint抛出“ Duplicate Platform Classes”错误。最好解决此问题,而不要使用建议的Lint解决方法,对吗?

棉绒建议: To solve this, you need to either find a newer version of the library which no longer has this problem, or to repackage the library (and all of its dependencies) using something like the jarjar tool, or finally, rewriting the code to use different APIs (for example, for http code, consider using HttpUrlConnection or a library like okhttp).

我创建了一个新的“基本活动”项目,并一次添加了我应用程序的依赖项,直到抛出Lint错误,此错误由opencsv触发。

棉绒错误:

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
    }
}

全绒建议:

There are a number of libraries that duplicate not just functionality of the Android platform but using the exact same class names as the ones provided in Android -- for example the apache http classes. This can lead to unexpected crashes.

To solve this, you need to either find a newer version of the library which no longer has this problem, or to repackage the library (and all of its dependencies) using something like the jarjar tool, or finally, rewriting the code to use different APIs (for example, for http code, consider using HttpUrlConnection or a library like okhttp).
Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.
To suppress this error, use the issue id "DuplicatePlatformClasses" as explained in the Suppressing Warnings and Errors section.

这里的任何指导将不胜感激!

0 个答案:

没有答案