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.
Related
I have followed the steps here to create asset packs for an Android app, except that at step 8 I am receiving the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:assetPackDebugPreBundleTask'.
> Could not resolve all task dependencies for configuration ':app:assetPackFiles'.
> Could not resolve project :installtime_assetpack.
Required by:
project :app
> Project :app declares a dependency from configuration 'assetPackFiles' to configuration 'packElements' which is not declared in the descriptor for project :installtime_assetpack.
Gradle is reporting version 6.5. Has something changed that I need to add something else?
I was going to delete this question, however I figured someone might make the same bone-head error as I did, which was to have the wrong folder name for one of the assets, i.e. I had installtime_asset_pack when it should have been installtime_assetpack
If you still have same issue just try to rename your gradle.build (in folder of your assetpack) to build.gradle - it seems stupid but it helped me.
Also you can take a look to a similar file in the \Intermediate\Android\gradle\assetpacks\install-time\obbassets, and see what the name of that gradle file.
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'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
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 updated to Android Studio 3 Canary build 2, which bumped up my build tools like so:
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
Now when I try to build I get this issue:
Error:.../values.xml:3490 (integer) -1 is less than minimum integer 0
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 ':app:processStagingResources'.
Failed to execute aapt
So I took a look at line 3490 of the file referenced above and got this:
<item name="android:numColumns">auto_fit</item>
Because it references I GridView style, I went to the docs and found that AUTO_FIT has a value of -1
I'm not sure why I'm getting this issue but I've tried cleaning/building, restarting and I still get that issue. Any idea what to try?
You can disable AAPT2 by putting this in your gradle.properties file:
android.enableAapt2=false
Try upgrading your build tools to 26.0.2 or newer, it was a bug in AAPT2, it should be fixed now.
If you're still using an alpha or a beta of AndroidStudio try upgrading to Android Studio 3.0.