Mohsen
Mohsen

Reputation: 307

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

Upvotes: 2

Views: 3231

Answers (3)

user3898288
user3898288

Reputation: 59

I suggest you change these

you use it

implementation 'androidx.appcompat:appcompat:1.0.0'

change to

  implementation 'androidx.appcompat:appcompat:1.+'

and

androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'

change to

    androidTestImplementation 'androidx.test:runner:1.+'

Upvotes: 0

Azade Rahmati
Azade Rahmati

Reputation: 207

I updated these 3 lines in my gradle

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

Upvotes: -1

Mohsen
Mohsen

Reputation: 307

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

Upvotes: 9

Related Questions