1

I'm getting this error on my Gradle project Sync. I've literally tried to do everything I've found in here and none of it worked. This all happened when i tried to link firebase to my project.

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.shrinkio"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-appindexing'
}

apply plugin: 'com.google.gms.google-services'
Tomas Mota
  • 672
  • 5
  • 27
  • Possible duplicate of [Error:(1, 0) Plugin with id 'com.android.application' not found](https://stackoverflow.com/questions/24795079/error1-0-plugin-with-id-com-android-application-not-found) – Martin Zeitler Feb 27 '19 at 23:28
  • The answer might be the same, but I'm looking for different answers, since the ones from my "duplicate" are not working for me... – Tomas Mota Feb 27 '19 at 23:37
  • how did you integrate firebase? because if you go Tools -> Firebase there is whole setup for every service and by following that setup everything is done automatically. – Faisal Feb 27 '19 at 23:59
  • @TomasMota added an answer for the updated question; close vote retracted. an hour ago, it was a whole other error message - and the answers below do reflect that. next time, please one question per question. else it gets difficult to identify a correct answer. – Martin Zeitler Feb 28 '19 at 01:13

3 Answers3

4

Try the latest Android Gradle as below

buildscript {
repositories {
    google() 
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
 }
}
Mustafa Shahoud
  • 640
  • 6
  • 13
  • think that `google()` and `maven { url 'https://maven.google.com' }` is exactly the same repo, once it's aliased, once not; that's a redundant configuration; one of them is enough. – Martin Zeitler Feb 28 '19 at 11:06
1

update your "build.gradle" file codes to following codes :

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.google.com' }
        //   mavenCentral()
        mavenLocal()
        maven { url "https://dl.bintray.com/drummer-aidan/maven" }

        mavenCentral()
        maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

    }
}

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

then go to "gradle-wrapper.properties" and change last sentence to this code :

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

I hope this answer be useful for you

1

that dependency is missing a version number, this should rather be:

implementation "com.google.firebase:firebase-appindexing:17.1.0"

the repository is google().

Martin Zeitler
  • 1
  • 19
  • 155
  • 216