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

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.

Related

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

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
}
}

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 build gradle error (android 3.1.3)

I reinstalled my android studio and thereafter i am getting error while building gradle.
I did every change that can help in building gradle but then also it showed error as "configure build" error.
so kindly help me so that i can start my android programming.
gradle version - 4.4
android plugin version - 3.1.3`
i have changed google() to maven() but nothing happened.
//build.gradle file
// Top-level build file where you can add configuration options common to all
sub-projects/modules.
buildscript {
repositories {
google()
jcenter { url 'http://jcenter.bintray.com' }
}
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()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

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