Исправить ошибки разрешения зависимостей в Gradle - PullRequest
1 голос
/ 19 сентября 2019

Когда я обновляю зависимость okhttp3 с 3.4.1 до 4.1.0, мой проект не может быть собран и выдает следующие ошибки.

Duplicate class org.intellij.lang.annotations.Identifier found in modules annotations-12.0.jar     
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
Duplicate class org.intellij.lang.annotations.JdkConstants found in modules annotations-12.0.jar     
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$AdjustableOrientation found in modules 
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar       
(org.jetbrains:annotations:13.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$BoxLayoutAxis found in modules annotations-                              
12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$CalendarMonth found in modules annotations- 
12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$CursorType found in modules annotations-   
12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$FlowLayoutAlignment found in modules        
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar  
(org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$FontStyle found in modules annotations-  
12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$HorizontalAlignment found in modules   
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar 
(org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$InputEventMask found in modules   
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar  
(org.jetbrains:annotations:13.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$ListSelectionMode found in modules  
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar  
(org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$PatternFlags found in modules annotations-
12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$TabLayoutPolicy found in modules 
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar  
(org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$TabPlacement found in modules annotations-        
12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$TitledBorderJustification found in modules 
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar 
(org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.JdkConstants$TitledBorderTitlePosition found in modules    
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$TreeSelectionMode found in modules   
annotations-12.0.jar (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.Language found in modules annotations-12.0.jar 
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.MagicConstant found in modules annotations-12.0.jar 
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.Pattern found in modules annotations-12.0.jar 
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.PrintFormat found in modules annotations-12.0.jar       
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

Duplicate class org.intellij.lang.annotations.PrintFormatPattern found in modules annotations-12.0.jar  
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

   Duplicate class org.intellij.lang.annotations.RegExp found in modules annotations-12.0.jar     
   (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

   Duplicate class org.intellij.lang.annotations.Subst found in modules annotations-12.0.jar  
   (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

    Duplicate class org.jetbrains.annotations.Nls found in modules annotations-12.0.jar  
    (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

     Duplicate class org.jetbrains.annotations.NonNls found in modules annotations-12.0.jar 
     (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
     Duplicate class org.jetbrains.annotations.NotNull found in modules annotations-12.0.jar \
    (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
    Duplicate class org.jetbrains.annotations.Nullable found in modules annotations-12.0.jar 
    (com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
    Duplicate class org.jetbrains.annotations.PropertyKey found in modules annotations-12.0.jar   
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)
Duplicate class org.jetbrains.annotations.TestOnly found in modules annotations-12.0.jar                  
(com.intellij:annotations:12.0) and annotations-13.0.jar (org.jetbrains:annotations:13.0)

    Go to the documentation to learn how to Fix dependency resolution errors.

Возникает проблема с дублирующимися зависимостями (annotations-12.0.jarи annotations-13.0.jar) и добавили туалет в мой файл Gradle.

 apply plugin: 'com.android.application'

 buildscript {
   repositories {
      mavenCentral()
   }

  dependencies {
   }

 }

repositories {
  mavenCentral()
 }

 android {
signingConfigs {
    release {
        keyAlias 'schoolber'
        keyPassword 'keystore123'
        storeFile file('../publish/keystore.jks')
        storePassword 'keystore123'
    }
    debug {
        keyAlias 'schoolber'
        keyPassword 'keystore123'
        storeFile file('../publish/keystore.jks')
        storePassword 'keystore123'
    }
}
compileSdkVersion rootProject.ext.COMPILE_SDK_VERSION
buildToolsVersion rootProject.ext.TOOLS_VERSION
defaultConfig {
    applicationId "com.schoolberpte.schoober"
    minSdkVersion rootProject.ext.MINIMUM_SDK_VERSION
    targetSdkVersion rootProject.ext.TARGET_SDK_VERSION
    versionCode rootProject.ext.VERSION_CODE
    versionName rootProject.ext.VERSION_NAME
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    vectorDrawables.useSupportLibrary=true
    multiDexEnabled true
}
applicationVariants.all { variant ->
    variant.resValue "string", "version_name", variant.versionName
    variant.resValue "string", "version_name_string", "Version " + variant.versionName
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        debuggable true
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

dataBinding {
    enabled true
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/CONTRIBUTORS.md'
    exclude 'META-INF/LICENSE.md'
    exclude 'META-INF/MANIKEST.MF'
    exclude 'META-INF/rxjava.properties'
  }

 buildToolsVersion '28.0.3'
 }

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:4.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
implementation 'com.google.code.gson:gson:2.8.5'
testImplementation 'junit:junit:4.12'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation project(':slidingmenu')
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation files('libs/signalr-client-sdk.jar')
implementation files('libs/signalr-client-sdk-android.jar')
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.18.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.facebook.rebound:rebound:0.3.4'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.stripe:stripe-android:4.0.3'
implementation 'com.code-troopers.betterpickers:library:3.0.1'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'net.danlew:android.joda:2.9.9.1'
implementation('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
    exclude group: 'com.google.android', module: 'support-v4'
}
implementation 'me.leolin:ShortcutBadger:1.1.10@aar'
implementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.intellij:annotations:+@jar'
implementation 'commons-io:commons-io:2.4'
implementation 'com.google.android.exoplayer:exoplayer:2.10.4'
implementation 'com.github.vipulasri:timelineview:1.1.0'

 }
apply plugin: 'com.google.gms.google-services'

Я не могу устранить эту ошибку, я попытался явно указать зависимость от комментариев, но она не решает мою проблему,вот статья средняя , на которую я смотрел.

1 Ответ

2 голосов
/ 19 сентября 2019

В вашем Gradle 2 из implementation 'androidx.cardview:cardview:1.0.0'.
Удалите один из них, затем выполните повторную синхронизацию.

ОБНОВЛЕНИЕ

удалить implementation 'com.intellij:annotations:+@jar' тоже

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...