java - 程序类型已存在 : retrofit2. Converter$Factory Retrofit 编译错误

标签 java android gradle retrofit retrofit2

我正在使用改造库,它给出了编译错误

Message{kind=ERROR, text=Program type already present: retrofit2.Converter$Factory, sources=[Unknown source file], tool name=Optional.of(D8)}

我的app/build.gradle文件就像

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2') {exclude group: 'com.android.support', module: 'support-annotations' }
    implementation 'com.android.support:appcompat-v7:27.0.0-alpha1'
    implementation 'com.android.support:cardview-v7:27.0.0-alpha1'
    implementation 'com.android.volley:volley:1.0.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.github.shrikanth7698:Custom-Navigation-Drawer:v0.0.1'
    implementation files('libs/retrofit-2.4.0.jar')
    implementation files('libs/converter-gson-2.4.0.jar')
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
    implementation 'com.airbnb.android:lottie:2.5.5'
    implementation 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
    implementation 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
    implementation 'com.google.apis:google-api-services-vision:v1-rev369-1.23.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}

最佳答案

我同时使用了 Volley 和改造。这就是造成错误的原因。我在一个项目中启动了这个项目,没有使用volley,就解决了

关于java - 程序类型已存在 : retrofit2. Converter$Factory Retrofit 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51369545/

相关文章:

java - 预约类

JavaFX : Integrating Spring framework with JavaFX app(Incorrect configuration)

java - 使用 BufferedOutputStream 会导致应用程序停止

android - 使用 Jenkins 构建 Unity 项目失败

kotlin - 即使注销后仍连续运行Gradle-build App(作为服务器守护程序)

java - 如何在 Spring 中将 Multipart 文件作为字符串读取?

android - 当设备不支持时,NFC权限是否会导致错误?

android - 仅在调试版本变体中包含 Stetho

android - 编译器无法解析 io.ktor.client.features.logging 中的类

java - 为什么 Gradle 编译 Java 项目失败?