Could not find support-media-compat.aar
Asked Answered
C

4

5

Trying Firebase to an android gradle app. As soon as I add the firebase dependency I get the following build error.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find support-media-compat.aar (com.android.support:support-media-compat:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-media-compat/26.1.0/support-media-compat-26.1.0.aar
> Could not find support-core-utils.aar (com.android.support:support-core-utils:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-core-utils/26.1.0/support-core-utils-26.1.0.aar
> Could not find support-compat.aar (com.android.support:support-compat:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar
> Could not find support-compat.aar (com.android.support:support-compat:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar

It looks like it's only searching jcenter. But every reference of jcenter has other repos listed to search.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.2.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven {
            url 'https://maven.google.com'
        }
    }
}

app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "io.nme.samples.displayingabitmap"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 181
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    api 'com.android.support:appcompat-v7:24.2.1'
    api 'com.android.support:support-v4:24.2.1'

    testImplementation 'junit:junit:4.12'

    dependencies {

        api project(':extension-api')
        api project(':haxe-firebase')
    }

    implementation 'com.google.firebase:firebase-core:16.0.4'
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

What am I missing here?

Chair answered 4/11, 2018 at 1:18 Comment(2)
Show your app-level Gradle too.Unanimity
Okay, I edited the main question.Chair
U
4
api 'com.android.support:appcompat-v7:24.2.1'
api 'com.android.support:support-v4:24.2.1'

That's your problem right there. Even without Firebase, this should've been causing issues. You're targeting and building with API 28, but your support dependencies are at API 24. Change them to use 28.0.0.

Also check your extension-api and haxe-firebase projects and make sure they're using the latest compile and SDK versions, as well as build tools version and support library versions.

Unanimity answered 4/11, 2018 at 3:17 Comment(2)
Thank you! That did it. Didn't know those had to be in sync.Chair
Can you please specify the path to go and edit this ?Gradation
F
13

I came across the same issue about locating libraries. However by adjusting the repositories order, this issue has been resolved.

repositories {
    google()
    jcenter()
    // others
}

It seems that a maven site hosted by google is what we're looking for in the first place.

BTW, maven { url 'https://maven.google.com'} is used for Gradle version lower than 4.1 and google() is the newer form of that. See also this doc.

Fernandofernas answered 5/12, 2018 at 3:45 Comment(3)
thanks a lot, spent more than 30 min before trying this.Egerton
I tried this as a shot in the dark and it worked - then saw that you commented this. wow. just wow.Sonics
Can you please specify the path to go and edit this ?Gradation
U
4
api 'com.android.support:appcompat-v7:24.2.1'
api 'com.android.support:support-v4:24.2.1'

That's your problem right there. Even without Firebase, this should've been causing issues. You're targeting and building with API 28, but your support dependencies are at API 24. Change them to use 28.0.0.

Also check your extension-api and haxe-firebase projects and make sure they're using the latest compile and SDK versions, as well as build tools version and support library versions.

Unanimity answered 4/11, 2018 at 3:17 Comment(2)
Thank you! That did it. Didn't know those had to be in sync.Chair
Can you please specify the path to go and edit this ?Gradation
P
1

You have to Replace 26.1.0 and use support library of version 28.0.0

Postmark answered 4/11, 2018 at 2:57 Comment(1)
I have no reference to 26.1.0 in my project. Not sure how I could do that.Chair
S
0

use below

buildscript {
ext.kotlin_version = '1.2.20'

repositories {
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'2.3.3
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}

allprojects {
repositories
        {
            maven { url "https://dl.google.com/dl/android/maven2/" }
            maven { url "http://jcenter.bintray.com/" }
            maven { url 'https://plugins.gradle.org/m2/'}
            maven { url "https://maven.google.com" }
            maven { url 'https://jitpack.io' }
            mavenCentral()
            flatDir {
                dirs 'libs'
            }
        }
}
Shaft answered 16/10, 2019 at 7:31 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.