【问题标题】:failed to resolve : firebase-analytics failed to resolve:play-service-base [duplicate]无法解决:firebase-analytics 无法解决:play-service-base [重复]
【发布时间】:2018-11-06 22:49:52
【问题描述】:

帮助我解决我的 gradle 中的这些错误。

错误:

警告:配置“androidTestCompile”已过时且具有 已替换为“androidTestImplementation”和“androidTestApi”。 它将在 2018 年底删除。有关更多信息,请参阅: http://d.android.com/r/tools/update-dependency-configurations.html

警告:配置“编译”已过时并已替换为 “实施”和“API”。它将在 2018 年底被删除。对于 更多信息见: http://d.android.com/r/tools/update-dependency-configurations.html

警告:配置“androidTestApi”已过时且已被 替换为“androidTestImplementation”。它将在 2018 年底。有关更多信息,请参阅: http://d.android.com/r/tools/update-dependency-configurations.html

警告:配置“testCompile”已过时并已被替换 使用“testImplementation”和“testApi”。它将在最后删除 2018 年。有关更多信息,请参阅: http://d.android.com/r/tools/update-dependency-configurations.html

警告:配置“testApi”已过时,已替换为 '测试实施'。它将在 2018 年底被删除。更多 资料见: http://d.android.com/r/tools/update-dependency-configurations.html

错误:无法解决:firebase-analytics 打开 文件

错误:无法解决:play-services-base Open 文件

在我的 gradle 中发现的那些错误和警告。

这些错误是最近出现的,以前没有问题。

这是我的应用程序 gradle:-

       'apply plugin: 'com.android.application'

    android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.alagappan.vivo"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner
        "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
      release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),      'proguard-rules.pro'
          }
         }
      compileOptions {
      targetCompatibility 1.8
      sourceCompatibility 1.8
    }
   }

      buildscript {
      repositories {
      jcenter()
    }
      dependencies {
         classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
     }
   }

dependencies {
   androidTestCompile('com.android.support.test.espresso:espresso-     core:2.2.2', {
     exclude group: 'com.android.support', module: 'support-annotations'
  })
  compile 'com.android.support:appcompat-v7:27.1.1'
  compile fileTree(include: ['*.jar'], dir: 'libs')
  compile 'com.android.support.constraint:constraint-layout:1.1.0'
  compile 'com.android.support:recyclerview-v7:27.1.1'
  compile 'com.android.support:cardview-v7:27.1.1'
  compile 'com.google.firebase:firebase-core:15.0.0'
  compile 'com.google.firebase:firebase-database:16.0.1'
  compile 'com.google.firebase:firebase-auth:16.0.1'
  testCompile 'junit:junit:4.12' 
  compile 'com.google.android.gms:play-services-auth:15.0.1'
  compile 'com.firebaseui:firebase-ui-database:3.2.2'
  compile 'com.android.support:design:27.1.1'
  compile 'com.firebase:firebase-client-android:2.5.0'
  compile 'com.andkulikov:transitionseverywhere:1.7.9'
 }' 



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()
      google()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:3.1.2'
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
  }
}

buildscript {
  dependencies {
      classpath 'com.google.gms:google-services:3.2.0' // google-services     plugin 
  }
}
allprojects {
  repositories {
      jcenter()
      google()
  } 
}

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

提前感谢各位朋友

【问题讨论】:

  • 现在我得到了正确的解决方案谢谢@Floern

标签: java android firebase gradle


【解决方案1】:

删除:

 compile 'com.firebase:firebase-client-android:2.5.0'

因为它已被弃用。 https://www.firebase.com/docs/android/quickstart.html

将顶级 gradle 文件更改为:

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:3.3.0'
  }
}

allprojects {
  repositories {
        google()
        jcenter()

    }
 }

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

https://developer.android.com/studio/releases/gradle-plugin

变化:

  • compileimplementation
  • androidTestCompileandroidTestApiandroidTestImplementation
  • testCompiletestApitestImplementation

https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration

【讨论】:

  • 我纠正了警告,但没有纠正错误
  • 当然,谢谢@Peter_Haddad
  • 对我来说关键是确保 google() 被列在第一位(参考 stackoverflow.com/questions/50562212/…
  • 是的 google() 列在答案@LordParsley 的首位
  • Yip @PeterHaddad 只是引起了人们的注意,因为我一开始并不认为这很重要,但我的排在第二位并且不起作用:-)
猜你喜欢
  • 2018-12-02
  • 1970-01-01
  • 2016-09-15
  • 2018-12-14
  • 1970-01-01
  • 2018-11-18
  • 1970-01-01
  • 1970-01-01
  • 2018-11-06
相关资源
最近更新 更多