Gradle Sync Failed Android Studio - android

I got the error message
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath':
Could not resolve androidx.appcompat:appcompat:1.1.0. Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for
':app#debugAndroidTest/compileClasspath': Could not resolve
androidx.appcompat:appcompat:1.1.0. Show Details Affected Modules: app
ERROR: Unable to resolve dependency for
':app#debugUnitTest/compileClasspath': Could not resolve
androidx.appcompat:appcompat:1.1.0. Show Details Affected Modules: app
I've unchecked Offline Work but still the same.
This is my build.gradle(project)
// 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.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.crudmahasiswa"
minSdkVersion 14
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.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Anyone please help me, i'm new on programming.. Thankyou

Related

I keep get Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath', when I use a library in gradle

I recently created a library using the File -> new Module -> Android Library, it worked on my app as the module was locally available to the project (same root directory), but when I pushed it to GitHub and published it on JitPack, using the library
implementation 'com.github.okraHQ:okra-android-sdk:v1.0'
I tried implementing it on the same project and a different project and
I got the error
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.okraHQ:okra-android-sdk:v1.0.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.okraHQ:okra-android-sdk:v1.0.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.github.okraHQ:okra-android-sdk:v1.0.
Show Details
Affected Modules: app
What would be the cause of the issue, I have followed other question but found no solution.
Below is the Build gradle of my Library:
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.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.0-beta01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
This is the build gradle for the application that uses the module
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.okra.widget.example"
minSdkVersion 14
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(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.github.okraHQ:okra-android-sdk:0.1-alpha'
}
This is the one for the project
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// 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' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Unable to resolve these errors?

/*These are the errors occurring while building the project any help regarding it to resolve it thanks.
Add while building project it take to much time and after downloading these errors are showing */
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.multidex:multidex:2.0.0.
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve androidx.multidex:multidex-instrumentation:2.0.0.
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve androidx.multidex:multidex:2.0.0.
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve androidx.multidex:multidex:2.0.0.
Build.gradle(App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.sherry.fitnessapp"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
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 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-firestore:21.1.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle(project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
/* these above are the files of dependencies i just put these and these error are occurring thankful your help and sorry to not and fully details if not described the question properly*/
I just rebuild the project ad these errors resolved, It's fun, And the Internet should also connected... :P

ERROR: Failed to resolve issue after changing classpath on android studio

After changing the classpath on dependencies on build.gradle to 3.3.2, I'm getting this Error:
ERROR: Failed to resolve: com.android.support:appcompat-v7:28.0.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.android.support.constraint:constraint-
layout:1.1.3
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.android.support.test:runner:1.0.2
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.android.support.test.espresso:espresso-
core:3.0.2
Show in Project Structure dialog
Affected Modules: app
This is my build.gradle(Project: MyApplication) file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//"/home/hb3hbahan1/Android-Studio/android-studio/gradle/gradle-3.3.2.pom"
google()
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the build.gradle(Module: App) file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
EDIT: I just commented out the entire dependencies except for the 3rd line on build.gradle(Module: app) and the errors are gone. is that gonna affect my future debugs etc?

android studio failed to resolve: runner and failed to resolve: espresso-core and failed to resolve: monitor

I installed android studio 3.1.3 and when I tried to build a new application .. During the gradle synchronization I had a problem as in the following picture:
Failed to resolve: espresso-core
Open File
Failed to resolve: runner
Open File
Failed to resolve: monitor
Open File
and that is my app(build.gradle):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.tareq.ds"
minSdkVersion 28
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
and that is my project(build.gradle):
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Follow these steps:
Open Module setting for the application
Under dependencies, tab Click on '+' Symbol and add all the required
dependencies one by one
Click on Apply button

Android studio 3 cannot download repository (error: Failed to download SHA1 for resource)

i use android studio version 3.0.0.
before update i use SDK manager for update support library. but after update android studio 3 i should update via https://dl.google.com/dl/android/maven2/. so i need support library 26.1.0.
on async gradle i have this error:
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve junit:junit:4.12.
Could not resolve junit:junit:4.12.
Required by:
project :app > com.android.support.test:runner:1.0.1
> Could not resolve junit:junit:4.12.
> Failed to download SHA1 for resource 'https://dl.google.com/dl/android/maven2/junit/junit/4.12/junit-4.12.pom'.
> For input string: "<!"
why cannot download this: https://dl.google.com/dl/android/maven2/junit/junit/4.12/junit-4.12.pom ?
i use proxy but cannot download.
this error is show for all dependencies library (appcampatv7, design, annonations and etc)
how to fix this Failed to download SHA1 for resource ?
UPDATE:
// 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.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.testtesttest"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
fixed this problem after a lot of search. in gradle.propertices file set proxy both http and https and sync again.
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyPort=12345
org.gradle.jvmargs=-Xmx1234m
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=12345

Categories

Resources