无法解决“所有com.android.support库都必须使用完全相同的版本规范”

时间:2019-03-09 10:31:34

标签: android dependencies conflict

由于依赖性冲突,我无法使用最新的targetSdkVersion 28和gradle:3.3.2编译我的项目“所有com.android.support库必须使用完全相同的版本规范”

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 369
        versionName "4.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "tier"
    productFlavors {
       playStoreFree {
            ...
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

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

关于这个问题,我在stackoverflow上阅读了很多答案,但是没有一个真的帮助我解决了这个问题。我在这里没有做任何花哨的事情,只是试图包括所有适用于Google Play,Google广告,firebase,facebook等的最新标准库。有人可以告诉我正确的配置吗?

当前,我对targetSDKVersion 27具有有效的配置:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 369
        versionName "4.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "tier"
    productFlavors {
       playStoreFree {
            ...
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':SliderPreference')
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.google.android.gms:play-services-analytics:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
}

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

3 个答案:

答案 0 :(得分:1)

对我来说,添加这些始终是一个问题:

from msvcrt import getch
tab=[]
while True:
    print('Please enter a number. Press ESC key if you want to exit')
    key = getch()
    if ord(key) == 27: #ESC
        print(tab)
        break
    else :
        tab.append(bytes.decode(key))

看起来您也需要这个:

implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'

答案 1 :(得分:0)

您正在项目中使用某些库。其中之一必须使用不同版本的支持库(可能是较低版本)。这些库的作者需要对其进行更新。但是在那之前,您可以观看下面提到的视频以获取解决方案。 本视频中使用的方法将为您提供很大的帮助。

https://www.youtube.com/watch?v=d-gvn-Z9hFs

答案 2 :(得分:0)

它似乎可以这种方式工作。很棒:)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 369
        versionName "4.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "tier"
    productFlavors {
       ...
    }


repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':SliderPreference')
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

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