I know about this questions:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
Could not resolve com.android.support:appcompat-v7:26.1.0 [duplicate]
Could not resolve com.android.support:appcompat-v7:26.1.0 in Android Studio new project
And I've read this documentations:
Migrate to Android Plugin for Gradle 3.0.0
So I'm posting this question believing its not a duplicate.
I've installed Android Studio 3.4.1. I didn't have any previous version before and I started a new project.
Every setting in Gradle file have been set by Android Studio itself and I've checked them all.
I have already tried
- invalidate and restart android studio
- Could not resolve com.android.support:appcompat-v7:26.1.0 in Android Studio new project
- Failed to resolve: com.android.support:cardview-v7:26.0.0 android
These are the file contents:
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
Top level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'https://maven.google.com/'}
maven { url "https://jitpack.io" }
maven { url 'https://dl.bintray.com/guardian/android' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
#Mon Jun 10 17:40:01 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
I use google()
in repositories as here clearly says:
// If you're using a version of Gradle lower than 4.1, you must instead use: // maven { // url 'https://maven.google.com' // }
My gradle version is 4.1 so I don't need above code.
But I still get this error as the others have been asking about:
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.constraintlayout:constraintlayout:1.1.3.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.lifecycle:lifecycle-runtime:2.0.0.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.legacy:legacy-support-core-ui:1.0.0.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.vectordrawable:vectordrawable-animated:1.0.0.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.
I have also unchecked the offline check box from gradle and using default
Why should I get this error when I'm creating a new project in AS 3.4.1
and it has been set all the necessary settings?