最高的firebase版本代码也用于编译播放服务库

时间:2018-05-24 15:22:36

标签: android firebase gradle android-gradle google-play-services

我在我的项目中使用某些firebase和play服务库。将play services插件版本更新到4.0.0后。由于firebase和play服务现在对每个库使用不同的版本编码策略,因此其中任何一个库中的最高版本代码将替换为所有其他库。这导致无法解析仍使用较小版本代码的库。

的build.gradle

    buildscript {

    ext.kotlin_version = '1.2.41'

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

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

app.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
//apply plugin: 'kotlin-kapt'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.vanse.android"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "8.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        manifestPlaceholders = [onesignal_app_id               : ONE_SIGNAL_APP_ID,
                                onesignal_google_project_number: "REMOTE"]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    lintOptions {
        abortOnError false
    }
}
buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
    }
}

repositories {
    maven { url 'https://maven.google.com' }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    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'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:support-vector-drawable:27.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:mediarouter-v7:27.1.1'

    //To upgrade dependency used in library picasso
    implementation 'com.android.support:exifinterface:27.1.1'
    //To upgrade dependency used in library OneSignal and Facebook
    implementation 'com.android.support:customtabs:27.1.1'
    //FireBase Dynamic Links
    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-invites:16.0.0'
    implementation 'com.google.firebase:firebase-appindexing:15.0.1'
    implementation 'com.google.firebase:firebase-ads:16.0.0'

    //Google Sign In
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-base:15.0.1'
    //ChromeCast
    implementation 'com.google.android.gms:play-services-cast-framework:15.0.1'
    //Download Manager
    implementation "com.tonyodev.fetch2:fetch2:2.0.0-RC19"
    implementation "com.tonyodev.fetch2downloaders:fetch2downloaders:2.0.0-RC19"
    implementation "com.tonyodev.fetch2rx:fetch2rx:2.0.0-RC19"
    implementation "com.tonyodev.fetchmigrator:fetchmigrator:2.0.0-RC19"
    //Kotlin Dependency
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    //Network Calls
    implementation 'com.android.volley:volley:1.1.0'
    //JSON Parsing
    implementation 'com.google.code.gson:gson:2.8.2'
    //Push Notification
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
    //Image Loader
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    //Facebook SDK
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    //Detect Memory leaks
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

    //Image Loading library
    implementation 'com.squareup.picasso:picasso:2.71828'
    //Image Caching library
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    //For live radio wave layout
    implementation 'me.itangqi.waveloadingview:library:0.3.5'
    //For audio and video player
    implementation 'com.google.android.exoplayer:exoplayer:2.7.3'
    //For multipart file upload
    implementation 'com.koushikdutta.ion:ion:2.2.1'
    //pulse animation
    implementation 'pl.bclogic:pulsator4droid:1.0.3'
    //Payment Gateway
    implementation 'com.razorpay:checkout:1.4.7'

    implementation('io.socket:socket.io-client:1.0.0') {
        exclude group: 'org.json', module: 'json'
    }
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
//    kapt 'com.github.bumptech.glide:compiler:4.7.1'
    implementation files('libs/tokenautocomplete-2.0.8.jar')
}

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

ERROR

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.google.firebase:firebase-appindexing:16.0.0.
  Required by:
      project :app
> Could not find com.google.firebase:firebase-ads:16.0.0.
  Required by:
      project :app
> Could not find com.google.android.gms:play-services-auth:16.0.0.
  Required by:
      project :app
> Could not find com.google.android.gms:play-services-gcm:16.0.0.
  Required by:
      project :app
> Could not find com.google.android.gms:play-services-location:16.0.0.
  Required by:
      project :app
> Could not find com.google.android.gms:play-services-base:16.0.0.
  Required by:
      project :app
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0 > com.google.firebase:firebase-dynamic-links:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0 > com.google.firebase:firebase-iid:16.0.0 > com.google.firebase:firebase-iid-interop:16.0.0
> Could not find com.google.android.gms:play-services-cast-framework:16.0.0.
  Required by:
      project :app
> Could not find com.google.firebase:firebase-messaging:16.0.0.
  Required by:
      project :app > com.onesignal:OneSignal:3.9.1
> Could not find com.google.android.gms:play-services-location:16.0.0.
  Required by:
      project :app > com.onesignal:OneSignal:3.9.1
> Could not find com.google.android.gms:play-services-base:16.0.0.
  Required by:
      project :app > com.onesignal:OneSignal:3.9.1
> Could not find com.google.android.gms:play-services-basement:16.0.0.
  Required by:
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-measurement-connector-impl:16.0.0
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-common:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-measurement-connector-impl:16.0.0 > com.google.firebase:firebase-measurement-connector:16.0.0
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0 > com.google.firebase:firebase-dynamic-links:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0 > com.google.firebase:firebase-iid:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0 > com.google.firebase:firebase-iid:16.0.0 > com.google.firebase:firebase-iid-interop:16.0.0
> Could not find com.google.android.gms:play-services-measurement-base:16.0.0.
  Required by:
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-measurement-connector-impl:16.0.0
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0 > com.google.firebase:firebase-dynamic-links:16.0.0
> Could not find com.google.android.gms:play-services-stats:16.0.0.
  Required by:
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0 > com.google.firebase:firebase-iid:16.0.0
> Could not find com.google.android.gms:play-services-tasks:16.0.0.
  Required by:
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-common:16.0.0
      project :app > com.google.firebase:firebase-invites:16.0.0 > com.google.android.gms:play-services-appinvite:16.0.0 > com.google.firebase:firebase-dynamic-links:16.0.0
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0 > com.google.firebase:firebase-iid:16.0.0
> Could not find com.google.android.gms:play-services-ads-identifier:16.0.0.
  Required by:
      project :app > com.google.firebase:firebase-core:16.0.0 > com.google.firebase:firebase-analytics:16.0.0 > com.google.firebase:firebase-analytics-impl:16.0.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 36s

2 个答案:

答案 0 :(得分:6)

这部分错误似乎表明您使用的Gradle插件(com.onesignal.androidsdk.onesignal-gradle-plugin)有错误,或者您需要更新的版本。

  

找不到com.google.firebase:firebase-appindexing:16.0.0。     要求:         项目:app

https://maven.google.com表示此库尚未发布(此时此时间点)。独立地,我可以明确地告诉您,该版本的图书馆尚未发布。

这里的插件源代码显示了我们的v15.x.x版本周围的特殊外壳(再次出现错误或需要更新的版本)。 https://github.com/OneSignal/OneSignal-Gradle-Plugin/blob/master/src/main/groovy/com/onesignal/androidsdk/GradleProjectPlugin.groovy#L293

如果您删除该插件,我认为您会看到您的应用停止尝试查找尚未发布的16.0.0库。

答案 1 :(得分:2)

对于任何来到这里并遇到同样问题的人,我已将Firebase版本从16.0.1降级到15.0.0,这与

相同
com.google.android.gms:play-services-maps:15.x.x

并将OneSignal插件升级到最新版本并且工作正常,如果有人在您尝试运行项目时遇到其他错误,则此警告可能会发生错误:

  

AGPBI:{" kind":"错误","文字":"程序类型已存在:android.support.design.widget。 CoordinatorLayout $ Behavior","来源":[{}],"工具":" D8"}

如果是这样,请在您的依赖项中添加以下行:

implementation 'com.android.support:design-v7:27.1.0'

也使用我在这里做的EXACT版本,否则你会遇到问题

你应该检查的其他事情:

    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:3.0.0'

希望它有所帮助,因为它让我待了2天,随时可以提出更多问题。快乐的编码