Java 当我尝试构建APK版本时获得[DuplicatePlatformClasses]。类似的问题来自opencsv库

Java 当我尝试构建APK版本时获得[DuplicatePlatformClasses]。类似的问题来自opencsv库,java,android-studio,Java,Android Studio,所以我花了很长时间才开始编写一个应用程序,当我去构建这个应用程序的APK版本时,它给了我一个[DuplicatePlatformClasses]错误,因为上次它没有给我任何错误,我后退了一步,我意识到一切都没问题,但是当我将opencsv库添加到Build.gradle中时,我开始出现这个错误,所以。。。如何解决这个问题 错误消息: > Task :app:lintVitalRelease FAILED D:\programs\Tajroobekonkoor\app\build.grad

所以我花了很长时间才开始编写一个应用程序,当我去构建这个应用程序的APK版本时,它给了我一个[DuplicatePlatformClasses]错误,因为上次它没有给我任何错误,我后退了一步,我意识到一切都没问题,但是当我将opencsv库添加到Build.gradle中时,我开始出现这个错误,所以。。。如何解决这个问题

错误消息:

 > Task :app:lintVitalRelease FAILED
D:\programs\Tajroobekonkoor\app\build.gradle: Error: 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. [DuplicatePlatformClasses]

   Explanation for issues of type "DuplicatePlatformClasses":
   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).

1 errors, 0 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> 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
      }
  }
  ...

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 798ms
11 actionable tasks: 1 executed, 10 up-to-date

是的,我有点明白了。。。 只需将opencsv库直接添加到您的项目中,并了解如何执行此操作……下载jar文件,然后像在此处一样添加它: