Библиотека com.google.android.gms: база измерения play-services-запрашивается библиотеками в [[15.0.4], [16.0.2]], но разрешается в 16.0.2 - PullRequest
0 голосов
/ 19 сентября 2018

Я искал решение и видел другой ответ на stackoverflow (например, solution 1 ) для этой ошибки.

это мой build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    signingConfigs {
    }
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'

    buildTypes {
        ...
    }

}

dependencies {
implementation files('libs/jsoup-1.8.1.jar')
implementation files('libs/org.apache.http.legacy.jar')
implementation files('libs/opencsv-3.8.jar')

implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.2'

implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'

implementation "com.android.support:design:27.1.1"
implementation "com.android.support:customtabs:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'

implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.installreferrer:installreferrer:1.0'

}

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

но каждый раз, когда я пытаюсь скомпилировать, я получаю сообщение об ошибке:

Библиотека com.google.android.gms: play-services-measure-base запрашивается различными другими библиотеками на [[15.0.4,15.0.4], [16.0.2,16.0.2]], но разрешается до 16.0.2.Отключите плагин и проверьте дерево зависимостей, используя ./gradlew: app: dependencies.

Это мой build.gradle верхнего уровня:

buildscript {
repositories {
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }

    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    classpath 'com.google.gms:google-services:4.0.1'
    classpath 'io.fabric.tools:gradle:1.24.4'

   }
}

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

    }
}

Я только что обновил все зависимостидо последней версии, и я не знаю, как построить свой проект.

Спасибо!

Ответы [ 2 ]

0 голосов
/ 08 марта 2019

Чтобы устранить эту проблему, я следовал рекомендациям по интеграции Google firebase и внес следующие изменения в мои app / build.gradle и project / build.gradle

Перейдите по этой ссылке, если у вас есть какие-либо сомнения

https://firebase.google.com/docs/android/setup

изменения в app / build.gradle

    implementation (project(':react-native-firebase')) {
        transitive = false
     }
    implementation 'com.google.android.gms:play-services-base:15.0.2'
    implementation "com.google.firebase:firebase-core:16.0.1"
    implementation "com.google.firebase:firebase-messaging:17.4.0"

Изменения в project / build.gradle

repositories {

        google()
        jcenter()
        mavenCentral()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

//Below line of code should be latest if you are using firebase version 16.0 +

        classpath 'com.google.gms:google-services:4.2.0'// below google-services plugin
       
    }
    allprojects {
    repositories {
         google()// add it to top instead of bottom or somewhere in middle
        mavenLocal()
        mavenCentral()
        maven {
            url 'https://maven.google.com'
        }
       
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        
    }
}
0 голосов
/ 19 сентября 2018

Я только что выяснил, что порядок зависимостей важен ... теперь я поставил

implementation 'com.google.firebase:firebase-core:16.0.3'

вверху, и у меня нет проблем со сборкой!

это мойсборка gradle:

dependencies {
implementation files('libs/jsoup-1.8.1.jar')
implementation files('libs/org.apache.http.legacy.jar')
implementation files('libs/opencsv-3.8.jar')

implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-config:16.0.0'

implementation 'com.google.firebase:firebase-messaging:17.3.2'

implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'

implementation "com.android.support:design:27.1.1"
implementation "com.android.support:customtabs:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:preference-v7:27.1.1'

implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
    transitive = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.installreferrer:installreferrer:1.0'


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