Anurag
Anurag

Reputation: 33

ERROR: Failed to resolve: com.google.android.material:material-rc01: Affected Modules: app

After adding 'com.google.android.material:material-rc01' in place of com.android.support:design as per documentation, studio failed to detect the dependency. Then I downgrade the version of dependency to implementation 'com.google.android.material:material:1.1.0-alpha09'

and it works. But why this problem arises? any explanation?

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib- 
    jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.android.material:material-rc01'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso core:3.2.0'
}

ERROR: Failed to resolve: com.google.android.material:material-rc01: Affected Modules: app

Upvotes: 3

Views: 6191

Answers (2)

FranK
FranK

Reputation: 159

The error arises due to the fact that you're not specifying a version for the implementation; the program needs the following:

  1. The group
  2. The name of the dependency to implement
  3. Version of the dependency

All this is covered in more detail here

When I got this error message, I solved it with the below line:

implementation 'com.google.android.material:material:1.0.0-rc01'

As you can see, the line above follows the implement 'compileGroup:name:version' pattern from the list, which in this case is 1.0.0-rc01; -rc01 seems to be a name for the version, just like -alpha09.

Note as well that you are not downgrading as you say if you didn't specify a version previously, which is why your app couldn't build.

Upvotes: 13

wkukielczak
wkukielczak

Reputation: 509

I just had the same issue. I solved it by using the following dependency:

implementation "com.google.android.material:material:1.0.0"

To solve such issues you always can check if the lib you are looking for does really exists in Google's Maven repo: https://dl.google.com/dl/android/maven2/index.html

Hope that help, cheers!

Upvotes: 7

Related Questions