Search code examples
javaandroidandroid-studiogradleandroidx

Android gradle failed to resolve core right after creating a androidx project


I'm creating a new android project with androidx in android studio 3.3 and i get error below right after project creation

ERROR: Failed to resolve: core
Affected Modules: app


ERROR: Failed to resolve: collection
Affected Modules: app


ERROR: Failed to resolve: annotation
Affected Modules: app


ERROR: Failed to resolve: lifecycle-common
Affected Modules: app


ERROR: Failed to resolve: core-common
Affected Modules: app

I've downloaded latest google support repositories, gradle 4.10.1, gradle android tools 3.3.0, Also i've checked my access to maven.google.com and jcenter.bintary.com and it's fine.

I've also cleaned project and restarted android studio but none of them worked

My dependencies :

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'

And all projects repositories :

google()
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()

Unfortunately, error isn't clear and i don't know due to what this happens, Thanks for your helps


Solution

  • Bug was because of android studio's default androidx dependencies versions, I changed my dependencies to:

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.0.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
    }
    

    And it's now working fine. I get these version from here