This is the output of my gradle console please help me out to solve this error, I am unable to build my project
Information:Gradle tasks [:facebook:generateDebugSources, :facebook:mockableAndroidJar, :facebook:prepareDebugUnitTestDependencies, :facebook:generateDebugAndroidTestSources, :lagaiKhai:generateDebugSources, :lagaiKhai:mockableAndroidJar, :lagaiKhai:prepareDebugUnitTestDependencies, :lagaiKhai:generateDebugAndroidTestSources]
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error:Execution failed for task ':lagaiKhai:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Information:BUILD FAILED
Information:Total time: 23.24 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
I once accidently added .gif file in drawable folder, and faced this issue, if you find any unwanted file in drawable foalder.
Follow the following steps:-
Remove all such files which are not recognised by drawable foalder (.gif, 9-patch, etc).
Close android studio and start it again
Clean and build project again
You are good to go again!
A temporary solution is to place the code below in the module build.gradle:
android {
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
And Sync the Project.Works for me.`
Try checking all the recentenly added 9patch files. they all must have the content markers on the 4 sides of the image
I created a 9-Patch file according to https://developer.android.com/studio/write/draw9patch.html, as a result of that, I faced the same error.
I had drew just the parts I wanted to stretch, but not the entire line.
To fix it I drew the entire right and bottom lines of the 9-patch, and the parts I wanted to stretch I did it on the left and top lines.
I used the Invalidate Cache and Restart Invalidate Cache and Restart option in android studio and it worked for me.
most of the time is a corrupt PNG image added recently to the project which cause this error. Check the git log and replace the file.
Sometimes menu : File > InvalidateCaches/Restart also helps
The problem is due to the .9 patch image file which you have added in the drawable.
To fix the issue.
1) Check you have named the 9 patch image as(file_name.png to file_name.9.png). E.g: "myimage.9.png" in the drawable folder.
2) Must Ensure that the 9 patch image file contains the "Content Marker on the 4 sides of the image". (i.e: if you open the image in Android studio, you will able to view 4 black lines on 4 sides of the image.)
3) if you not able to view the Content Marker on the sides of the image, then kindly rename the image file from (file_name.9.png to file_name.png), the error will be vanished.
Related
Trying to build the app but have got the error: The error Confugure image asset1
Confugure image asset2
Confugure image asset3
ERROR:C:\Users\Alex\AndroidStudioProjects\Lm2\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:3: AAPT: error: resource mipmap/ic_launcher_background (aka com.example.lm2:mipmap/ic_launcher_background) not found.
How can I resolve this?
I hope you have
put your launcher icons into the mipmap folder where they should always go.
added your adaptive icon to the app’s manifest.xml for “android:icon” (android:roundIcon) attribute
.
Fist hand try: Clean your project and Rebuild
Probable Issue reason: Malformed XML:
Solution:
Check if you have anything duplicated by mistake in your XML
Try Analyze > Inspect Code it will redirect you to the exact error.
My app is for view images When user click on next button show next image or back button show the previous image, the problem started When I tried to run the project I see some error about images size
"The file is too large; 80.83M. Showing a read-only of the first 2.56M".
I tried this solution the privous message is disappered but I still see some errors
Error:error: failed to read data meta data.
Error:failed parsing overlays.
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
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
The first error
The second error
1) Write android:largeHeap="true" in your manifest under application.
2) Go to File -> Invalidate caches/restart -> Just restart. This will clear all caches.
3) Go to Build -> Clean project
4) Go to Build -> Rebuild project
Why do you need a PNG this big? A good practice is to keep your APK size as small as possible, with a reasonable size for an app like yours around 4MB. Even if you crunch these PNG images they will still be way too big and result in a huge size of your APK.
According to the Android Developers' guide:
Users often avoid downloading apps that seem too large, particularly
in emerging markets where devices connect to often-spotty 2G and 3G
networks or work on pay-by-the-byte plans.
More info: here
Every time I have running my project I received this error, despite I put it:
android.enableAapt2=false
Inside the build window, where you can see the tree with red and green circles - notice that on the left panel there's a green hammer? Just under it is an icon to change the tree view to the gradle console output. Please click that icon and scroll through the logs - the AAPT errors should be in there.
I have two 9.png images created with the generator Nine Patches. When I run the app Android Studio stops and say me that the images have an error on the pixel #394. What is the problem??
These are the images.
The error in the log:
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: Failed to run command:
C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4.2\aapt.exe s -i D:\Users\McFly\AndroidStudioProjects\Syncro\app\src\main\res\drawable-xxhdpi\spinner_line.9.png -o D:\Users\McFly\AndroidStudioProjects\Syncro\app\build\res\all\debug\drawable-xxhdpi\spinner_line.9.png
Error Code:
42
Output:
ERROR: 9-patch image D:\Users\McFly\AndroidStudioProjects\Syncro\app\src\main\res\drawable-xxhdpi\spinner_line.9.png malformed.
Frame pixels must be either solid or transparent (not intermediate alphas).
Found at pixel #364 along top edge.
Rename the file to example.png rather than example.9.png. I had same issue in past and renaming helped me.
I recently added some .gifs to my /drawable so that I can use them with buttons. This worked fine (no errors). Now, when I go to rebuild/run my application, I get the following error:
Error: Gradle: Execution failed for task ':MyProject:mergeDebugResources'. > Index: 0
I'm not sure how to fix this (and there appears to be no other similar issues that I could find online.
Edit: Now it's the same error, but it also says (at the end of the first error)
Running /Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt failed. See output
Okay, I fixed the issue. It was quite weird.
A) I had some capital letters in my res/drawables folder. Not too weird -- I can see how that would remove the first error.
B) Then, however, a lot of values in my main activity file became undefined. I had to manually import 'com.myapp.R'. Now that was weird.
Fortunately, everything is now working.
I hope that if anyone gets the same errors as me, that this response can help them.