Android resource compilation failed (cache file error ) - android

i'm not able to build my project anymore and I'm getting some error regarding one of the catch files and specifically it takes me to a value called:layoutCron
i took some screenshots to the build console to show the error that happens when trying to build the project...
1-
2-
3-
4-
5-
when i try to go any further and find the file that they gave me it's path i find this :
the gradle version i'm using is 4.9 ...
with this in the project build gradle :
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
classpath 'com.google.gms:google-services:4.1.0' }

Three steps to resolve the problem
Use a more stable gradle version as 4.4-all
Update Android Support Plugin version to 3.1.4
Rebuild Project
gradle-wrapper.properties file content:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Top-level build file: dependencies:
classpath 'com.android.tools.build:gradle:3.1.4'
Finally to show the effect clear gradle cache using File | Invalidate Caches/Restart
after doing that you won't have any problem in the build part
NOTE :
if android studio regenerated the files and gave you the same error afterwards you can just disable Aapt2 but that will only work till the end of 2018
you do that by adding android.enableAapt2=false
to the gradle.properties file .

Related

classes.jar' already contains entry 'META-INF/module_name_debug.kotlin_module', cannot overwrite

In project i am using kotlin dsl, jetpack compose, com.android.tools.build:gradle:7.0.0-alpha08, many modules and i am continuously getting this error.
Zip file 'E:\project_name\module_name\build\intermediates\compile_library_classes_jar\debug\classes.jar' already contains entry 'META-INF/module_name_debug.kotlin_module', cannot overwrite
Any combinations of exclude/pickFirst/merge
packagingOptions {
exclude/pickFirst/merge("META-INF/module_name_debug.kotlin_module")
}
just doesnt work.
Is there some solution?
reference to : issuetracker.google.com/issues/183632446
disable Make Project Automatically option under:
Preferences | Build, Execution, Deployment | Compiler
just delete the build ( E:\project_name\module_name\build ) folder and rebuild the project
If you are on Bumblebee and higher. Make project automatically(only works while not running/debugging) option has been removed.
Upgrading your project to use the latest version of gradle in build.gradle and gradle.properties should fix this error.
For my current project I'm using this in build.gradle
classpath "com.android.tools.build:gradle:7.1.1"
gradle.properties
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

ANDROID STUDIO 3.0 upgrade : Error:Could not resolve all files for configuration ':app:xxxxxxxDebugCompileClasspath'

I found this warning after upgrading the latest android studio stable version
Error:Could not resolve all files for configuration ':app:xxxxxxxDebugCompileClasspath'.
Failed to transform file 'commons-lang-2.4.jar' to match attributes {artifactType=android-classes} using transform JarTransform
Transform output file xxxxxxx/xxxxxxx/xxxxxxx/app/commons-lang-2.4.jar does not exist.
here is gradle and gradle wrapper versions :
gradle : classpath 'com.android.tools.build:gradle:3.0.0'
and
gradle wrapper :
distributionUrl=https\://services.gradle.org/distributions/g‌​radle-4.1-all.zip
change dependency declaration
from
compile files('libs/commons-lang-2.4.jar')
to
implementation files('libs/commons-lang-2.4.jar')
I had the same problem, build -> clean project worked for me.
Change the classpath of Project Gradle to:
classpath 'com.android.tools.build:gradle:3.1.0-alpha01'
OR
change distributionUrl of gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Hope it helps you
I had same problem , googled a lot but nothing worked. Following worked for me on Android 4.2.1
Go to File -> Manage IDE Settings -> Restore IDE Settings
Then follow the instructions.

Gradle sync completed with some errors

I am trying to add a google services plugin for google sign in.
Syncing the project after adding some lines in the project level and the app level build.gradle files results in the following:
Gradle project sync completed with some errors
Accompanying message :
Warning:Gradle version 2.10 is required. Current version is 2.4. If
using the gradle wrapper, try editing the distributionUrl in
/home/vin***/Documents/Projects/F/gradle/wrapper/gradle-wrapper.properties
to gradle-2.10-all.zip
How do I resolve this?
Open your project folder in windows explorer and open gradle folder in it.
Go to wrapper folder, there you will find gradle-wrapper.properties file.
Its contents would be something like
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Change the distributionUrl's end to 2.10... or whatever your warning says.
Go to Settings => Build, Execution, Deployment => Gradle => choose Use default gradle wrapper
This is probably because you have set in you build.gradle
classpath 'com.android.tools.build:gradle:+'
You have to options:
Change your distributionUrl in your gradle-wrapper.properties to https\://services.gradle.org/distributions/gradle-2.10-all.zip
Change your build.gradle to an specific version like
classpath 'com.android.tools.build:gradle:1.3.0'
In my case I use the second one, because like you, I use gradle-2.4.
Hope this helps!!

getting error when importing project in android studio?

Recently i updated my android studio to 0 .30 I was trying to import project in android studion.
Project is using an old version of the Android Gradle plug-in. The minimum supported version is 0.6.1.
Please update the version of the dependency 'com.android.tools.build:gradle' in your build.gradle files.
Consult IDE log for more details (Help | Show Log)
2nd error
You are using an old, unsupported version of Gradle. Please use version 1.8 or greater.
Please point to a supported Gradle version in the project's Gradle settings or in
the project's Gradle wrapper (if applicable.)
Consult IDE log for more details (Help | Show Log
3rd error
Could not execute build using Gradle distribution '
http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Build file 'C:\Users\Asthme\crushersblue1\babies\build.gradle' line: 8
Could not find method classpath() for arguments
[com.android.tools.build:gradle:0.6.+] on project ':crushersblue1:babies'.
Consult IDE log for more details (Help | Show Log)
Step 1: Change line in build.gradle from:
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
Step 2:
In the YourProject.iml file, delete the entire component name="FacetManager" tag.
Step 3
(Maybe not necessary): In the Android SDK manager, install (if not already installed) Android Support Repository under Extras.
Refer this
I was able to fix this by using the file path to my gradle directory:
C:\Users\xxxx.gradle\wrapper\dists\gradle-1.12-all\2apkk7d25miauqf1pdjp1bm0uo\gradle-1.12
the import continued fine.
This is duplicate of Unable to import Eclipse project to Android Studio (when using default gradle wrapper)
Answer:
I had to edit the gradle wrapper settings in
gradle/wrapper/gradle-wrapper.properties and change gradle version
to 1.8.
./gradle/wrapper/gradle-wrapper.properties :
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
I had to change gradle-1.6-bin.zip to gradle-1.8-bin.zip. I guess
the old ADT plugin from eclipse which generates this file still uses
the old URL.
If all the other solutions here do not work (they are all from 3 days ago)... I found...
I had secondary project in my settings.gradle and each of those projects had their own build.gradle. The Android Studio IDE says that you need to uddate to 0.6.1 but it points to only the first-project build.gradle - I had to manually locate the secondary build.gradle file for those projects and make sure all said 0.6.+ instead of previous versions.
Change gradle to 0.6.+ as ling has suggested, and also in your gradle-wrapper.properties file, change the distributionUrl to http\://services.gradle.org/distributions/gradle-1.8-bin.zip.

Unable to import Eclipse project to Android Studio

Whenever I try to import my Eclipse project to Android Studio I get the following error :
You are using an old, unsupported version of Gradle. Please use
version 1.8 or greater. Please point to a supported Gradle version in
the project's Gradle settings or in the project's Gradle wrapper (if
applicable.)
Consult IDE log for more details (Help | Show Log)
Im using Android Studio 0.3 and Ubuntu, I also tried it on a Windows 8 box with fresh install but getting the same error. I'm using default gradle wrapper and I tried checking and unchecking auto import option. Is this a bug? How can I get around it. How do I update gradle to 1.8 or check the current gradle version?
I had to edit the gradle wrapper settings in gradle/wrapper/gradle-wrapper.properties and change gradle version to 1.9.
./gradle/wrapper/gradle-wrapper.properties :
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
I had to change gradle-1.6-bin.zip to gradle-1.9-all.zip. I guess the old ADT plugin from eclipse which generates this file still uses the old URL.
Then I had to create a local.properties in project root and set correct SDK dir in it.
./local.properties
sdk.dir=/home/user/pathtosdk
Did that and imported using default gradle wrapper and voila! The project imported without any problem.
Notes: This also fixes the issue with org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution 'services.gradle.org/distributions/gradle-1.6-bin.zip';.: Could not execute build using Gradle distribution 'services.gradle.org/distributions/gradle-1.6-bin.zip'; You must also make sure that in the file ./build.gradle, com.android.tools.build:gradle:0.5.+ should be changed to com.android.tools.build:gradle:0.7.+.
If you are still experiencing problems with import, open up the project root in command line and run ./gradlew or gradlew.bat according to your os. You'll be getting errors with more debug info and maybe tips on how to solve them.
For me line in build.gradle file
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
Also needed to be updated to import correctly in Android Studio.
I had exactly the same problem.
I solved this issue. Download latest Gradle manually and unpack it, then when you import gradle file in Android studio choose "Use local gradle distribution" and select the folder where you unpacked gradle. By doing this you will be able to import project to Android studio.

Categories

Resources