after upgrading to the latest version of android studio (2024.2.1) and upgrading gradle and AGP I am facing these error messages when try to run on device but gradle sync success:
Could not isolate parameters com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@68af1da1 of artifact transform AarResourcesCompilerTransform
> Could not isolate value com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@68af1da1 of type AarResourcesCompilerTransform.Parameters
> Could not resolve all files for configuration ':app:detachedConfiguration3'.
> Could not find com.android.tools.build:aapt2:8.3.1-10880808.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/8.3.1-10880808/aapt2-8.3.1-10880808.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/aapt2/8.3.1-10880808/aapt2-8.3.1-10880808.pom
Required by:
project :app
my build setups are as follow (all files merged with name on top of each section):
file: libs.versions.toml
[versions]
agp = "8.7.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.6.1"
material = "1.10.0"
constraintlayout = "2.1.4"
navigationFragment = "2.6.0"
navigationUi = "2.6.0"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "navigationFragment" }
navigation-ui = { group = "androidx.navigation", name = "navigation-ui", version.ref = "navigationUi" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
file: build.gradle(application)
plugins {
alias(libs.plugins.android.application) apply false
}
file: build.gradle(module :app)
plugins {
alias(libs.plugins.android.application)
}
android {
namespace 'com.example.myapplication'
compileSdk 35
defaultConfig {
applicationId "com.example.myapplication"
minSdk 24
targetSdk 35
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation libs.appcompat
implementation libs.material
implementation libs.constraintlayout
implementation libs.navigation.fragment
implementation libs.navigation.ui
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
}
file: gradle-wrappers.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
file: settings.gradle
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
this is a sample project for android studio. android studio 2024.2.1 running on a ubuntu 20.04
what I've done so far?
but the error is not GONE yet and problem persists.
I believe knowing gradle issues is a long journey that I've failed in it.
(the config and error messages don't match because I tested all variations and copy wrong configs)
update:
after adding below lines to build.gradle(project) top level:
buildscript {
repositories{
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:aapt2:8.7.0-12006047")
}
}
the error changed to below:
Execution failed for task ':app:processDebugResources'.
Could not isolate parameters com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@337bd7f9 of artifact transform AarResourcesCompilerTransform Could not isolate value com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@337bd7f9 of type AarResourcesCompilerTransform.Parameters > Could not resolve all files for configuration ':app:detachedConfiguration2'. > Failed to transform aapt2-8.7.0-12006047-linux.jar (com.android.tools.build:aapt2:8.7.0-12006047) to match attributes {artifactType=_internal-android-aapt2-binary, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Could not find aapt2-8.7.0-12006047-linux.jar (com.android.tools.build:aapt2:8.7.0-12006047). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/8.7.0-12006047/aapt2-8.7.0-12006047-linux.jar
again I can download the link in the above error manually, it's a multi megabytes .jar file
but I don't know why android studio is not able to download it
after days of exploring and investigating the problem I fixed this ugly problem.
I don't know why the heck the gradle was bypassing the proxy for downloading the AGP (android build tools for gradle) and firewall was blocking the connection. (not effected by other files)
I fixed this issue by syncing the project manually using gradlew command line and setting the proxy in args
from bottom left side of android studio (version ladybug) I opened the terminal which is already in projects main directory then entered the below command:
./gradlew assembleDebug -DsocksProxyHost=localhost -DsocksProxyPort=1234
where socksProxyHost and socksProxyPort are variant and up to you. mine were localhost and 1234 (because I used local socks proxy and bound to port 1234)
and thanks for Erden Savasci and Robert that tried to help me <3