Gradle 使用Google Cloud Translation Client Library for Java(Android)时出错

Gradle 使用Google Cloud Translation Client Library for Java(Android)时出错,gradle,build.gradle,google-translate,Gradle,Build.gradle,Google Translate,我正在尝试使用谷歌的云翻译API制作一个谷歌翻译应用程序。当我试图编译编译'com.google.cloud:google cloud translate:1.14.0'时,在APK project.properties中复制了错误作为重复文件 我的android代码如下(java代码没有问题) My build.gradle如下所示(由于下面给出的编译语句而出现问题) 我得到的错误如下: 错误:与项目中的依赖项“com.google.code.findbugs:jsr305”冲突:app。应

我正在尝试使用谷歌的云翻译API制作一个谷歌翻译应用程序。当我试图编译编译'com.google.cloud:google cloud translate:1.14.0'时,在APK project.properties中复制了错误作为重复文件

我的android代码如下(java代码没有问题)

My build.gradle如下所示(由于下面给出的编译语句而出现问题)

我得到的错误如下:

  • 错误:与项目中的依赖项“com.google.code.findbugs:jsr305”冲突:app。应用程序(3.0.0)和测试应用程序(2.0.1)的解析版本有所不同。有关详细信息,请参阅

  • 警告:警告:Dependency org.apache.httpcomponents:httpclient:4.0.1在发布时被忽略,因为它可能与Android提供的内部版本冲突。 如果出现问题,请使用jarjar重新打包以更改类包

  • 警告:警告:Dependency org.json:json:20160810在发布时被忽略,因为它可能与Android提供的内部版本冲突。 如果出现问题,请使用jarjar重新打包以更改类包

  • 我在下面的链接中尝试了所有方法,但没有效果。错误仍在增加


    • 必须包括以下内容:

      android {
      packagingOptions {
          exclude 'project.properties'
          exclude  'META-INF/INDEX.LIST'
          exclude 'META-INF/NOTICE'
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/notice'
          exclude 'META-INF/notice.txt'
          exclude 'META-INF/license'
          exclude 'META-INF/license.txt'
      }
      
      
          defaultConfig {
          javaCompileOptions {
              annotationProcessorOptions {
                  includeCompileClasspath false
              }
          }}
      

      }

      帮助我使用谷歌翻译API制作翻译应用程序
      apply plugin: 'com.android.application'
      
      android {
          compileSdkVersion 25
          buildToolsVersion "25.0.2"
          defaultConfig {
              applicationId "com.googletranslation"
              minSdkVersion 22
              targetSdkVersion 25
              versionCode 1
              versionName "1.0"
              testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
          }
          buildTypes {
              release {
                  minifyEnabled false
                  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              }
          }
      }
      
      dependencies {
          compile fileTree(dir: 'libs', include: ['*.jar'])
          androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
              exclude group: 'com.android.support', module: 'support-annotations'
          })
          **compile 'com.google.cloud:google-cloud-translate:1.14.0'**
          compile 'com.android.support:appcompat-v7:25.2.0'
          compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
          testCompile 'junit:junit:4.12'
      }
      
      android {
      packagingOptions {
          exclude 'project.properties'
          exclude  'META-INF/INDEX.LIST'
          exclude 'META-INF/NOTICE'
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/notice'
          exclude 'META-INF/notice.txt'
          exclude 'META-INF/license'
          exclude 'META-INF/license.txt'
      }
      
      
          defaultConfig {
          javaCompileOptions {
              annotationProcessorOptions {
                  includeCompileClasspath false
              }
          }}