无法解决:com.google.firebase:firebase-core:16.0.1-仅1个build.gradle

时间:2018-10-09 00:21:59

标签: android firebase gradle

我目前正在尝试将Firebase添加到较旧的android应用程序中,以更新已弃用的GCM。

由于某种原因,该项目在项目中只有一个build.gradle文件。

我已尝试按照Google的“将Firebase添加到您的Android应用”中的步骤添加Firebase。

但是,当我添加firebase-core时,在同步时我会不断收到错误:

  

无法解决:com.google.firebase:firebase-core:16.0.1

我尝试遵循here的指示,但无济于事。

我的项目结构与上述here类似。我很乐意提供其他必要的信息

如何让Firebase在只有1个build.gradle的Android项目上工作?

build.gradle:

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.0.2'
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}
apply plugin: 'com.android.application'

dependencies {
    implementation files('libs/GoogleAnalyticsServicesAndroid_3.01/libGoogleAnalyticsServices.jar')
    implementation files('libs/aws-android-sdk-2.1.7-sns.jar')
    implementation files('libs/aws-android-sdk-2.1.7-core.jar')
    implementation "com.google.android.gms:play-services:6.5.87"
    implementation 'com.google.firebase:firebase-core:16.0.1'
}

android {
    compileSdkVersion = 22
    buildToolsVersion = '27.0.3'

    defaultConfig {
        applicationId "app.name.here"
        minSdkVersion 18
        targetSdkVersion 22
        versionCode 45
        versionName "2.8.2"
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        //instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

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

0 个答案:

没有答案