如何避免Android Gradle依赖中的冲突

如何避免Android Gradle依赖中的冲突,android,gradle,google-places,Android,Gradle,Google Places,我是android新手,正在做一个旧的android项目。它有一个Google Places自动完成功能,目前无法使用,因为它使用的Android PlacesSDK目前已被弃用。如果没有这个功能,一切正常,但是当我尝试添加PlacesSDKimplementation'com.google.android.libraries.places:places:1.0'自动完成place功能时,gradle同步成功,但当尝试运行应用程序时,所有xml文件都会显示错误,因为资源链接失败或重复值对于“at

我是android新手,正在做一个旧的android项目。它有一个Google Places自动完成功能,目前无法使用,因为它使用的Android PlacesSDK目前已被弃用。如果没有这个功能,一切正常,但是当我尝试添加PlacesSDK
implementation'com.google.android.libraries.places:places:1.0'
自动完成place功能时,gradle同步成功,但当尝试运行应用程序时,所有
xml
文件都会显示错误,因为资源链接失败或重复值对于“attr/font”和“config”等资源,我的问题是如何在不干扰他人的情况下使用此sdk。下面是我的应用程序级别
Gradle
文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
//buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.myappo"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 27
    versionName "1.5"
    manifestPlaceholders = [HOCKEYAPP_APP_ID: "51a9c4471559421b8d53a07cbb3e3fa0"]
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
lintOptions { checkReleaseBuilds false }
buildTypes {

    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
    //incremental true
}

repositories {
    jcenter()
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
useLibrary 'org.apache.http.legacy'
}
   allprojects {
repositories {
    google()
}
repositories {
    maven {
        url 'https://maven.google.com'
    }
}
repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}
}

dependencies {


implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.android.support:design:25.1.0'
implementation 'com.google.maps.android:android-maps-utils:0.4'
implementation 'com.google.android.gms:play-services:10.0.1'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.hbb20:ccp:1.7.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'net.hockeyapp.android:HockeySDK:4.1.3'
implementation 'com.android.support:recyclerview-v7:25.1.1'
implementation 'com.android.support:cardview-v7:25.1.1'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.0.0'
implementation 'com.google.firebase:firebase-messaging:9.6.0'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.krtkush:LinearTimer:v2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.bumptech.glide:glide:3.6.1'
implementation 'com.iarcuschin:simpleratingbar:0.1.5'
implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'
testImplementation 'junit:junit:4.12'

implementation 'com.google.android.libraries.places:places:1.0.0' // this is creating problem
}
apply plugin: 'com.google.gms.google-services'
这是
项目级
Gradle文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath 'com.google.gms:google-services:3.0.0'
     // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

从这个实现中删除括号(“com.google.android.libraries.places:places:1.0.0”)

将您的项目迁移到Android X,这是防止依赖冲突的最佳解决方案


虽然我同意迁移到androidx是最好的选择,我看不出androidx和google places库之间有什么关系。@Mithu提供项目级的gradle文件,我也看不出这有什么区别。这没有什么区别。你可以发布错误日志吗?错误开始于资源编译失败,但当我纠正一个错误后,它显示了另一个不受限制的错误。似乎需要为一个sdk更改整个项目代码