material-components-android: Could not find com.google.android.material:material:1.0.0-alpha1.

I followed the guide on page : https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md but I can’t import the library because gradle give me this error:

Could not find com.google.android.material:material:1.0.0-alpha1.
Searched in the following locations:
    file:/C:/Users/alevittoria/AppData/Local/Android/sdk/extras/m2repository/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    file:/C:/Users/alevittoria/AppData/Local/Android/sdk/extras/m2repository/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    file:/C:/Users/alevittoria/AppData/Local/Android/sdk/extras/google/m2repository/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    file:/C:/Users/alevittoria/AppData/Local/Android/sdk/extras/google/m2repository/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    file:/C:/Users/alevittoria/AppData/Local/Android/sdk/extras/android/m2repository/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    file:/C:/Users/alevittoria/AppData/Local/Android/sdk/extras/android/m2repository/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    https://jcenter.bintray.com/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    https://jcenter.bintray.com/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    https://maven.fabric.io/public/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    https://maven.fabric.io/public/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    https://dl.bintray.com/drummer-aidan/maven/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    https://dl.bintray.com/drummer-aidan/maven/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    https://maven.google.com/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    https://maven.google.com/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
    https://jitpack.io/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.pom
    https://jitpack.io/com/google/android/material/material/1.0.0-alpha1/material-1.0.0-alpha1.jar
Required by:
    project :app

I’m doing something wrong or is there a problem with the repository?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 14
  • Comments: 26 (8 by maintainers)

Most upvoted comments

Hi @alevittoria, can you try using com.android.support:design:28.0.0-alpha1 for now? Will update the docs soon.

I have the same issue

Yep, your app’s other Support Library dependencies should be updated as well. Here are release notes for 28.0.0-alpha1 - https://developer.android.com/topic/libraries/support-library/revisions#28-0-0-alpha1.

Regarding the missing attribute issue, I think this is because you need to update your compileSdkVersion to ‘android-P’. You’ll also have to download the Android P Preview using the SDK manager if you haven’t already. Here is a similar post - https://stackoverflow.com/questions/49171300/no-resource-found-that-matches-the-given-name-at-dialogcornerradius-with-valu.

@houdangui1985 change implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

to implementation 'androidx.constraintlayout:constraintlayout:1.1.0' implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'

I suggest you to get Android Studio 3.2 and go to Refactor -> Refactor to AndroidX

@houdangui1985 This library is a drop in replacement for the original Design Library, and the 28.0.0 releases are also from this repo. The only difference between the 1.0.0 and 28.0.0 releases is that for the 1.0.0 releases the library is packaged as com.google.android.material and depends on the new androidx jetpack libraries. The 28.0.0 releases will be the last of the android.support.* versions.

@Dwite that is correct. The next preview of P is coming soon which will allow you to publish to the Play Store. This page has some useful information about that and the timeline for Android P - https://developer.android.com/preview/overview.

@houdangui1985 see the response above from @marcoscgdev about updating your dependencies to androidx. I would also suggest using the new Refactor to AndroidX option in the latest version of Android Studio. Check out this page for more information on that - https://developer.android.com/studio/preview/features/#androidx_refactoring.

Here is a working example of a build.gradle file that uses the new androidx appcompat library and the new material components library:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-P'
    defaultConfig {
        applicationId "com.android.example"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    api 'androidx.appcompat:appcompat:1.0.0-alpha1'
    api 'com.google.android.material:material:1.0.0-alpha1'

    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha1'
}

This is my best attempt at the time:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-P'
    defaultConfig {
        applicationId "xl.domain.appname"
        minSdkVersion 21
        targetSdkVersion 'P'
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.google.android.material:material:1.0.0-alpha1'
    implementation 'com.android.support:design:28.0.0-alpha1'
    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'
}

Still getting an error:

Compilation failed to complete

Program type already present: android.support.v4.os.ResultReceiver$1
Message{kind=ERROR, text=Program type already present: android.support.v4.os.ResultReceiver$1, sources=[Unknown source file], tool name=Optional.of(D8)}

I was hoping the demo could help me but there is no library in that gradle

Can somebody provide with a working gradle please?

Will this issue be closed? It’s already in Google’s Maven repository: https://maven.google.com