java - 无法解析 : firebase-analytics failed to resolve:play-service-base

标签 java android firebase gradle

<分区>

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

错误:

Warning:Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Warning:Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Warning:Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Warning:Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Error:Failed to resolve: firebase-analytics Open File

Error:Failed to resolve: play-services-base Open File

在我的 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
}'

提前谢谢你

最佳答案

删除:

 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

改变:

  • 编译实现
  • androidTestCompileandroidTestApiandroidTestImplementation
  • testCompiletestApitestImplementation

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

关于java - 无法解析 : firebase-analytics failed to resolve:play-service-base,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50564742/

相关文章:

android - 无法使视口(viewport)元标记起作用

android - 如何设置多个每日闹钟?

android - 火力地堡 : Permission denied - while setValue()

java - Android,Firebase - 尝试检索多个子节点时,数据库仅将单个子节点作为字符串返回

java - 如何使用 Cargo Maven 插件部署在两个不同的 glassfish 域上?

java - 嵌套类中对象的数组

android - 经纬度为已知点计算100米距离

android - 无法在现有的Android Studio项目上连接到Firebase

java - 序列化:java.io.StreamCorruptedException:无效的流 header :0AACED00

java - 使用 Java 使用 Selenium WebDriver 获取页面标题