0

My project ran fine yesterday. I open it today and get this error:

Program type already present: com.google.android.gms.internal.auth.zzao

I tried updating the firebase libraries and then I get these errors and clicking install doesn't work:

Failed to resolve: com.google.firebase:firebase-core:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-maps:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-location:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-places:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-auth:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-basement:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-tasks:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.firebase:firebase-common:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.firebase:firebase-iid:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.firebase:firebase-measurement-connector:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-gcm:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog

I tried updating the target and compile sdk to 28 and get an error for all of the support libraries being lower than target sdk but don't get an option to update them to the latest. I tried updating build tools to 28.0.2 and that also didn't help, and it weirdly doesn't prompt me that it is behind, I had to manually go look at the latest installed and put it. Not sure what to try next. Nothing changed and it just stopped working. Below are my gradle files. Thanks.

App gradle

    buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.2'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.2'
    defaultConfig {
        applicationId "removed"

        manifestPlaceholders = [
                onesignal_app_id               : 'removed',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]

        minSdkVersion 19
        targetSdkVersion 27
        versionCode 50
        versionName "2.6"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.mikepenz:fontawesome-typeface:4.6.0.3@aar'
    implementation('com.mikepenz:materialdrawer:5.6.0@aar') {
        transitive = true
    }
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.eminayar.panterdialog:panter-dialog:0.0.2.1'
    implementation 'com.mikhaellopez:circularprogressbar:1.1.1'
    implementation files('libs/core-3.2.1.jar')
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.afollestad:material-cab:0.1.12'
    implementation 'com.sandrios.android:sandriosCamera:1.0.8'
    implementation 'com.github.paolorotolo:appintro:4.1.0'
    implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
    implementation 'com.onesignal:OneSignal:3.8.4'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-places:15.0.1'
    implementation ('com.facebook.android:facebook-android-sdk:4.33.0') {
        exclude(group: "com.google.zxing", module:"core")
    }
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.snapchat.kit.sdk:creative:1.0.2'
    implementation 'com.snapchat.kit.sdk:core:1.0.2'
}
apply plugin: 'com.google.gms.google-services'

Project gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.google.com" }
        maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.firebase:firebase-plugins:1.0.4'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.google.com" }
        maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
Michael
  • 1,084
  • 13
  • 18

1 Answers1

2

Update the firebase libraries:

    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'

and in the top level gradle file, add the google() at the beginning under repositories:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
 repositories {
     google()
     jcenter()
     maven { url "https://storage.googleapis.com/snap-kit-build/maven" }

  }
 dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    classpath 'com.google.firebase:firebase-plugins:1.0.4'
    classpath 'com.google.gms:google-services:4.0.1'
   }
}

allprojects {
   repositories {
     google()
     jcenter()
     maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
  }
}

 task clean(type: Delete) {
  delete rootProject.buildDir
 }
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • still get the error I put above about when I update firebase and clicking install repository on one gives and error like this : Could not find dependency "com.google.android.gms:play-services-gcm:17.3.0" – Michael Aug 14 '18 at 19:55
  • add u copy the top level gradle file as in the answer? – Peter Haddad Aug 14 '18 at 19:57
  • ok, so deleting the ones from the top of my app file as well fixes it, not sure if I need any of those there? – Michael Aug 14 '18 at 19:57
  • yes just copy and paste the top level gradle file from the answer, no you do not need `mavecentral()` https://stackoverflow.com/a/32000765/7015400. Also this `maven { url "https://maven.google.com" }` is the google() repo but it was used in old gradle version https://stackoverflow.com/questions/46467561/difference-between-google-and-maven-url-https-maven-google-com – Peter Haddad Aug 14 '18 at 19:58
  • ok, but for my onesignal stuff and maven { url 'https://plugins.gradle.org/m2/' } in the app file? Moving them to the project gradle gets rid of the error, but then where do I put the apply plugin line for onesignal? – Michael Aug 14 '18 at 20:07
  • 1
    leaving as I had originally in app file but changing the onesignal classpath to classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]' fixed the issue, thank you – Michael Aug 14 '18 at 20:13
  • https://documentation.onesignal.com/docs/android-sdk-setup should be in the app file – Peter Haddad Aug 14 '18 at 20:13