0

I'm currently trying to add Firebase to an older android application, to update GCM which is becoming deprecated.

For some reason this project only has one build.gradle file in the project.

I've attempted to add Firebase following googles steps for "Add Firebase to your Android App".

However, when I add the firebase-core, when syncing I continually receive an error:

Failed to resolve: com.google.firebase:firebase-core:16.0.1

I've attempted to follow the instructions here, to no avail.

My project structure looks very similar as the one mentioned here. I'll be happy to provide any other information that may be necessary

How can I get Firebase working on this Android project, that only has 1 build.gradle?

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'
Alkarin
  • 464
  • 7
  • 20
  • Firebase Core is at 16.0.4 now. – TheWanderer Oct 09 '18 at 00:23
  • @TheWanderer the issue persists regardless of the version used. – Alkarin Oct 09 '18 at 00:25
  • This looks like a pretty old project (by the way, if you want to publish this on the Play Store, you need to target at least API 26), especially since there seems to only be an app-level Gradle config. I think the easiest way to properly generate all the right configs would be to create a new project and copy your current classes over to it. Then follow the Firebase guides. – TheWanderer Oct 09 '18 at 00:40
  • @TheWanderer its definitely a very old project. I'll attempt building a new project from it tomorrow. – Alkarin Oct 09 '18 at 00:47

0 Answers0