I'm trying to switch over to AAPT2, and in the process I'm encountering this error with no hints from the error message as to how to fix.
The error occurs when gradle is on the task processDebugResources
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
I'm not really sure what the issue is, since the project was building with AAPT1 and there's nothing specifically in the migration guide regarding this. I do have one resource with an emoji in it, and so I have this in my build.gradle file:
aaptOptions {
additionalParameters '--utf16' // Allows emoji in XML
}
but even if I remove the emoji from the resource, and remove the aaptOptions block, the error persists. I've tried doing a clean build multiple times. If it makes any difference, I have a variety of resources, including xml, png, ttf, txt along with a variety of assets, including js, json, proto, and html. Would AAPT2 have an error with any of these?
Also when I run gradle build with stacktrace, I think I get some additional info
Caused by: org.gradle.tooling.BuildException: Failed to execute aapt
12:40:26.699 [ERROR]`[org.gradle.internal.buildevents.BuildExceptionReporter] at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:573)`
which seems to be implying it has something to do with apk splits, except I'm not using apk splits in my app at all. Furthermore there are many stacktraces which result in the same error, but all of the stacktraces themselves are different.
This is a lot of information, so hopefully it's enough to diagnose, but I'm personally lost and not sure what the cause of this problem is.
Did you tried this,
Go to your
gradle.properties
write the below code and Sync your project
android.enableAapt2=false
Related
When project is built with build:gradle:3.0.1, I've got this error.
AAPT2 error: check logs for details
I've tried solution
android.enableAapt2=false
in gradle.properties file
mentioned in this thread:
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
It works, but Java compiler gives warning,
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Can we resolve AAPT2 error without using android.enableAapt2=false ?
In my case, the error was beacause in the route where android studio was installed, i had a non-ASCII character (an accent to be more specific).
The most common case of this error is beacause the file manifest.xml have errors in it's structure.
Here is the structure it should have: https://developer.android.com/guide/topics/manifest/manifest-intro?hl=es-419
I created an empty project and added appcompat-v7-26.1.0 support. I'm getting many errors like that:
C:\Users\username.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\e0aabf040e64856c88683f1511ddf095\res\layout\tooltip.xml: error: file not found.
which lead to:
Error: java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
I can solve it by adding property in gradle.properties file
android.enableAapt2=false
... but this is rather workaround than fixing the cause. If you take a look at this missing file path it seems quite long so I was wondering if the path length may be the problem as posted for other issues here. Unfortunately I don't know how can I changed it as most of the length is inside the gradle directory, so even if I change GRADLE_USER_HOME path (C:\Users\username\.gradle in my case) it's not a big profit.
I also tried to set
android.enableBuildCache=true # false didn't work as well
android.buildCacheDir =c:\\temp\\
but with no luck. I'd appreciate a helping hand or any tip in this case.
Here is what I changed In build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:0.4.3'
}
issure here:
https://issuetracker.google.com/issues/36972228
I had similar issue.
Changing gradle runtime from Gradle 4.4.1 to Gradle 4.1 helped.
(no changes in dependencies, if you use Jenkins make sure that environment variables updated correctly gradle --version)
It looks like the problem is gradle is looking in C:\Users\username.gradle\caches for the cached appcompat libraries. I'm assuming that username.gradle doesn't exist? Or is that a typo?
In any case, I had a similar issue, and specifying the gradle user home directory fixed it. In my case, gradle was looking inside C:\Windows\System32\config\systemprofile, and not finding the cache because it didn't exist.
I set an environment variable for GRADLE_USER_HOME so that gradle would cache things in a set location. See this question for a little more detail.
When I use Android Studio 3.0 Beta 7 and update my project with the Android Gradle 3.0.0-beta7 plugin my project builds fine in both the debug and rc (proguard enabled) variants.
When I attempt to build on my Jenkins box, I get a bunch of:
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\androidsdk-2.4.12-fullRelease.aar\222313e24d6c4b00972b4191a95e6e2e\res\drawable-xxhdpi-v4\ic_teads_sdk_contact_us.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\c8fedf0a28e83c9ac57e1ac18693c6a0\res\drawable-hdpi-v4\abc_tab_indicator_mtrl_alpha.9.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\android-sdk-ui-2.0.4.aar\0b51ce1d665e491601444168a26000ca\res\drawable-xhdpi-v4\com_appboy_inappmessage_chevron.png: error: file not found.
What went wrong:
Execution failed for task ':mergeDevOnlySlDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
I tried to use AAPT instead of AAPT2 and that still gives me the same problem. My other jenkins projects that are not running this gradle 3 change still run fine. Also the files that can't be found from above are indeed on my machine in the location that AAPT can't find.
Has anyone run into this before?
I've seen error's online about invalid PNG or actual errors from using the new AAPT2, but this is different.
I solved this problem by adding the below line to the gradle.properties file:
android.enableAapt2=false
I am following google codelab for instant app. After I convert the original app to baseFeature and added another feature module which will then act like the application but will be based on the original baseFeature.
As per told in code lab, I changed the buld.gradle files and deleted the application component from the feature Module (Non Base module). When I try to build the project I get the follow error.
Error:(4) duplicate attribute
Error:/home/adventure/Desktop/android-topeka/topekaapk/build/intermediates/manifests/full/debug/AndroidManifest.xml:4 duplicate attribute
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':topekaapk:processDebugResources'.
> Failed to execute aapt
I got stabbed in my back by lint , YES LINT
Problem : As shown in the image Lint gave an warning for optimizing the import and I removed the xmlns property from manifest.
Solution : Do not delete the xmlns property
I am getting lint error in android studio as
Error:Execution failed for task ':app:lint'. Lint found errors in the
project; aborting build. Fix the issues identified by lint, or add the
following to your build script to proceed with errors:
android {
lintOptions {
abortOnError false
} }
Information:BUILD FAILED Information:Total time: 7.288 secs Information:1 >error Information:0 warnings
Build is getting failed
But it is not showing where exactly the error and even IDE(Android studio) is also not displaying any error mark in files.
How to redirect lint error to source file.?
I don't want to skip the lint check.
Please help me.
From the command line, run gradlew lintDebug (or gradlew lint[variantName] for a different variant).
This will generate a full lint report at /app/build/outputs. I recommend the HTML version (lint-results-debug.html). In there you will find all Android lint issues and their severity.
Alternatively, you can go to Analyze > Inspect Code in Android Studio to run lint. Switch the view to group them by severity- the errors are the ones blocking your build.
The erros reports with the lines and exactly erros font are found in: Your app release builds folder, then:appname/app/build/reports.
there you will find the lint-results-release-fatal. Open it in any browser to find the problems.
Hope it helps.