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

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?

Related

Could not find dependency "com.google.android.gms:play-services-maps:17.0.0" [duplicate]

Please help me...
I want to create a project based on Google Maps. But after building gradle in Android Studio, The following error occurs:
ERROR:
Failed to resolve: com.google.android.gms:play-services-maps:17.0.0
Install Repository and sync project
Show in Project Structure dialog
Affected Modules: app
When i clicked on the 'Install Repository and ...' then this message appear:
Could not find dependency "com.google.android.gms:play-services-maps:17.0.0"
NOTE:
Gradle work online mode.
I went to Setting and Android SDK then downloaded google play services.. but it is not working for me.
I also set up a proxy.
EDIT:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
root gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After much effort, I was able to solve the problem.
Strange as it may seem, the problem was solved by manually adjusting the proxy.
thanks all.

google-play-services-maps:17.0.0 is not working even with default project Android Studio created

Please help me...
I want to create a project based on Google Maps. But after building gradle in Android Studio, The following error occurs:
ERROR:
Failed to resolve: com.google.android.gms:play-services-maps:17.0.0
Install Repository and sync project
Show in Project Structure dialog
Affected Modules: app
When i clicked on the 'Install Repository and ...' then this message appear:
Could not find dependency "com.google.android.gms:play-services-maps:17.0.0"
NOTE:
Gradle work online mode.
I went to Setting and Android SDK then downloaded google play services.. but it is not working for me.
I also set up a proxy.
EDIT:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
root gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After much effort, I was able to solve the problem.
Strange as it may seem, the problem was solved by manually adjusting the proxy.
thanks all.

Gradle Sync Failed Android Studio

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

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 new project gradle sync fail

I recently updated android studio to 3.1.2 version and kotlin plugin to 2.41 and had the android support repository downloaded.
Since then i have been unable to create new projects.when i try to sync the gradle i get these:
-Failed to resolve: constraint-layout
-Failed to resolve: constraint-layout-solver
-Failed to resolve: viewmodel
-Failed to resolve: runtime
-Failed to resolve: livedata-core
-Failed to resolve: common
I sensed the problem may be failing to download from maven so i tried adding lines like:
maven{url "https://maven.google.com"}
but no luck.then i changed the implementation in my module:app gradle file from
`implementation 'com.android.support.constraint:constraint-layout:1.1`
to
`implementation 'com.android.support.constraint:constraint-layout:1.0.2'`
(which was the downloaded version mentioned in my sdk manager)
which resulted in this error:
-Could not find viewmodel.aar (android.arch.lifecycle:viewmodel:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.aar
which is funny because when i click on the link above a viewmodel-1.1.0.aar is downloaded!
What should i do to successfully sync the gradle?
Here is the app gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.example.mohamad.arkotlin"
minSdkVersion 'P'
targetSdkVersion 'P'
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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:28.0.0-alpha1'
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 the project gradle:
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Categories

Resources