Android Studio building issues - Could not resolve all artifacts for configuration - android

While building android app, Attached the issue i’m facing. Could not resolve all artifacts for configuration
Below is the project level gradle file i'm using.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried with gradle build tools versions(4.0.2, 4.1.0), still getting the same issue. 'Could not resolve all artifacts for configuration'
I’m using
Android Studio 4.1.2, working on always on VPN in windows machine, Before this(always on VPN) it used to work for me. Somehow this is not working now. Could some one help me one this.

you need to add this :
buildscript {
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
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
}
}

Related

Could not find com.android.tools.build:gradle:3.6.0-rc01

when I tried to begin my first Android project, I got this a problem with this message
[A problem occurred configuring root project 'My Application'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find com.android.tools.build:gradle:3.6.0-rc01.]1
this is my build.gradle file
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0-rc01'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have downloaded the latest gradle version 6.4.1.
I also tried to change the repositories to all the following:-
-repositories {
google()
jcenter()
}
-repositories {
google()
}
-repositories {
google()
mavenCentral()
jcenter()
}
None of them worked
I am using a Psiphon Vpn (I'm not sure if it's related)
i'm using intellj IDEA 2020.1.1
and I'm using Gradle 6.4.1
I've used android studio 3.6.3 but it did work either.
I hope you can help me
Use classpath 'com.android.tools.build:gradle:3.6.3'

Could not find com.android.tools.build:gradle:3.0.1. project from Github

I would like to open ten https://github.com/mukundmadhav/Wordpress-to-Android-app project in Android Studio. However, I have a problem.
I'm getting errors
ERROR: Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
project :
Add Google Maven repository and sync project
Open File
I tried to solve the problem with these methods
Gradle 4.1 issue on latest android studio 3.0.1
Could not find com.android.tools.build:gradle:3.0.1
Could not find com.android.tools.build.gradle:3.0.0-alpha7
However, nothing helped, does anyone know how to open this project?
Update:
Android Version 3.4.1
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
There should be google() repo in repositories which searches plugins/libraries in google repository.
Also, version number for com.android.tools.build should match the Android Studio Version. For example: for Android studio 3.4.1, classpath dependency should be:
classpath 'com.android.tools.build:gradle:3.4.1'
Here is the modified code for 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'
classpath 'com.google.gms:google-services:4.2.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
}
Check if google() is present in repositories in the top level build.gradle
allprojects {
repositories {
jcenter()
google()
}
}
P.S - If you're using Android Studio 3.1 or higher, you should be able to click on Add Google Maven repository and sync project and allow Android Studio to make the necessary corrections by itself and resync the gradle.

Android studio build failed. Could not find method allprojects() for arguments

I tried to build my ionic application on Android using Capacitor. But when I tried to build and run an application on android studio, it gives this error. I don't have any android studio knowledge. The error:
Could not find method allprojects() for arguments [build_al8rrgnflynwtjpadzojip71i$_run_closure1#68017a4f] on settings 'android' of type org.gradle.initialization.DefaultSettings.
The build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.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
}
Instead of allprojects in root project gradle, there is another repositories block in dependencyResolutionManagement, which worked for me.

Could not find com.android.tools.build:gradle-experimental:3.4.0 in android studio

my build.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com/"
}
}
dependencies {
//classpath 'com.android.tools.build:gradle:2.1.2'
// classpath 'com.android.tools.build:gradle-experimental:0.7.2'
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories {
mavenCentral()
mavenLocal()
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and Sync error occurs like below
ERROR: Could not find com.android.tools.build:gradle-experimental:3.4.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.jar
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.jar
Required by:
project :app
all classpath is doesn't work
how can I fix it?
You probably need to change the "distributionURL" in gradle-wrapper.properties.
In this page you can see, which gradle version you need.
In your example, I think, this will be the "distributionURL":
distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Because Gradle and the Android plugin run independently from Android Studio, you need to update the build tools separately. Hope this helps... Here is a link to a how to vid. https://www.google.com/search?rlz=1C1GCEA_enNA829NA829&ei=zd7dXOybJ9Hhgwef9KHAAg&q=update+gradle+in+android+studio&oq=update+gra+in+android+studio&gs_l=psy-ab.1.0.0i7i30j0i7i5i30.96964.99326..104851...0.0..0.327.3123.2-1j9......0....1..gws-wiz.......0i71.NTQ5itjULUs#kpvalbx=1
Add google() in your repositories list in build.gradle.
buildscript {
repositories {
jcenter()
google()
}

Android studio 3.0 - Cant run app

So far i only worked on the computer from my job and today im trying to setup my project on my home computer but no luck so far.
I guess it has to with gradle configurations or android studio 3.0 but the settings are the same for both computers, i get no errors but cant click the run button, adding run configuration doesnt work either.
My gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha6'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven { url 'http://github.com/wada811/Android-Material-Design-Colors/raw/master/repository/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I dont know if this will help but my gradle.build is this for my apps. Maybe try using mine? Or an upgrade on your android studio, I know the earlier ones have bugs. The newer versions always seem to run more smoothly
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Categories

Resources