How to upgrade to com.android.tools.build:gradle:7.1.3 in Android Studio - android-studio

I have upgrade Android Studio to the latest version shown here:-
Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 16, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.20-release-275-AS7442.40), com.android.aas (3.6.0)
once the upgrade completed I have attempted to upgrade the gradle to 7.3.1
classpath 'com.android.tools.build:gradle:7.1.3'
which appeared to complete ok
however my application build now fails with this message
Could not find com.android.tools.build:gradle:7.1.3.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.3/gradle-7.1.3.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.3/gradle-7.1.3.pom
Required by:
project :
Add google Maven repository and sync project
Open File
My project gradle resembles this
buildscript {
ext.kotlin_version = "1.6.20"
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.41'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
clicking on the link Add google Maven repository and sync project does nothing
how can I resolve this build error?

Change your maven url from
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
}
to
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
then press Sync Project

I had same this problem in may macbook.
I was uninstall android studio and install again update patch 2021.1.1 Patch 3.
But I don't update gradle plugin 7.1.3.
I think 7.1.3 don't found in gradle website.
https://gradle.org/releases/
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Related

Updated my Android Studio from 3.4.2 to 4.0,but unable to sync project due to missing of SDK 29(I have downloaded)

Error:
Could not resolve all files for configuration ':app:androidApis'.
Failed to transform android.jar to match attributes {artifactType=android-mockable-jar,
org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=false}.
Execution failed for MockableJarTransform: C:\Users\DELL\AppData\Local\Android\Sdk\platforms\android-
29\android.jar.
Cannot create mockable android.jar
C:\Users\DELL\AppData\Local\Android\Sdk\platforms\android-29\android.jar (The system cannot find the file specified)
Build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.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
}
Distribution Url
https://services.gradle.org/distributions/gradle-6.1.1-all.zip
I have tried installing and Uninstalling SDK 29 and Tools ,but same error exists.
Please Help.

Generate Signed APK gives an error in Android Studio 3.4

Build APK and run application on external device work properly, but When I am trying to generate signed APK I got the error message
Could not find com.android.tools.lint:lint-gradle:26.4.
Here is my Project build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
//mavenCentral()
}
}
some of articles suggest to change classpath version but I think 3.4.2 is the latest version of gradle.
By updating my android studio to 3.5, problem was fixed. I don't know the reason. this one was my last chance
You should put google() as the first repo inside buildscript{}, i.e.
buildscript {
repositories {
google() //// <--- here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}

Upgrading gradle breaks exoplayer on build, can't find core or dash

Android studio
Gradle version: 4.1
Android plugin version: 3.0.1
implementation 'com.google.android.exoplayer:exoplayer:2.8.4'
Build works fine. Upgrade to these versions:
Gradle version: 4.6
Android plugin version: 3.2.1
implementation 'com.google.android.exoplayer:exoplayer:2.8.4' //unchanged
Build fails with these messages:
Failed to resolve: com.google.android.exoplayer:exoplayer-core:2.8.4
Failed to resolve: com.google.android.exoplayer:exoplayer-dash:2.8.4
I've been stuck on this for a day. I can't find any reason why it should work with the old version, but not the new.
I had to add the following line to allprojects repositories.
allprojects {
repositories {
google()
jcenter()
maven { url 'https://google.bintray.com/exoplayer/' } //new line
}
}
Apparently, Exoplayer is no longer in JCenter. But, the files are still in bintray.
Here you can find explanation and temporary solution for this problem
https://github.com/google/ExoPlayer/issues/5225
you add project build.gradle
repositories {
google()
jcenter()
}
and add
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
}

Gradle Sync failed: Could not find method implementation()

Been trying to resolve this error for hours...cant get it solved. I am a newbie to Android Studio
My project level build.gradle file is as follows
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
And my app build.gradle file is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 18
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.amazonaws.androidtest"
minSdkVersion 8
targetSdkVersion 18
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
aaptOptions {
cruncherEnabled = false
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
}
}
apply plugin: 'com.google.gms.google-services'
Getting the following error when trying to sync
Gradle sync failed: Could not find method implementation() for arguments [com.google.firebase:firebase-core:16.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I am using Android Studio 2.3
Tried to upgrade Gradle to version 4 but that requires Android Studio 3. Cant install Android Studio 3 for now.
Also added the maven url's as some answers suggested. Still not working.
Any other way to resolve this?
with build-tools 3.1.4, it should become known (read below):
classpath "com.android.tools.build:gradle:3.1.4"
but if you cannot update Android Studio , use compile instead of implementation.
compile "com.google.firebase:firebase-core:16.0.3"

Gradle synchrozination Error

I am new to Android, and working in studio2.2 beta version.
My build.gradle file has following content
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {url 'http://repo1.maven.org/maven2'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
But on synchronization , Its giving the following error
Error:Could not find com.android.tools.gradle:2.0.0:.
Searched in the following locations:
file:/D:/android-studio/gradle/m2repository/com/android/tools/gradle/2.0.0//2.0.0-.pom
file:/D:/android-studio/gradle/m2repository/com/android/tools/gradle/2.0.0//2.0.0-.jar
https://jcenter.bintray.com/com/android/tools/gradle/2.0.0//2.0.0-.pom
https://jcenter.bintray.com/com/android/tools/gradle/2.0.0//2.0.0-.jar
Required by:
:MyApplication:unspecified
Any help ?
try:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// 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
}
Current android gradle tool version is 2.2.0 for android studio 2.2. Also, you can now use stable release, no need for beta version
classpath 'com.android.tools.gradle:2.2.0'
Also you need gradle 2.14.1+ for this plugin.

Resources