androidxandroid-studio-3.5

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


Solution

  • 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.