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.
Related
When I build the project I receive following error message :
:app:kaptDebugKotlin
java.lang.reflect.InvocationTargetException (no error message)
There is no more information from Android Studio, and I can not figure out the issue. I appreciate any suggestion.
I found the solution, You can see the actual details after clicking on the above line in the Build Output section of the build tab. You will see more details when you will click on the highlighted part drawn by pen.
The line above where IDE is pointing in the left build output section
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.
I have 2 problem that I think both of them is for one reason:
When I try to add a new XML layout; that XML fail add successfully but in "Console" show me it:
[2014-05-04 18:41:11 - Example] W/ResourceType( 5804): ResXMLTree_node size 0 is smaller than header size 0x14.
[2014-05-04 18:41:11 - Example] D:\Android\Workspace\Example\res\menu\main.xml:4: error: Error: Resource id cannot be an empty string (at 'actionLayout' with value '#android:layout/').
and I can get resource to it in classes.
In "problem" tab:
Errors: Unparsed aapt error(s)! Check the console for output.
Location: line 1
Type: Android ADT Problem
and I cant solve it
Please same one help me ...
I sorted this out. So for anyone else still on the learning curve with me, the solultion is as noted in my comment. In addition -
aapt = Android Asset Packaging Tool From the Developers Guide - "The Android Asset Packaging Tool (aapt) takes your application resource files, such as the AndroidManifest.xml file and the XML files for your Activities, and compiles them."
The solution for me was simply to delete the error on the 'Problem' window (right click | delete). Then, force a rebuild by rerunning the app. Any remaining problems will now show up and be logged so you can track them down.
Hope this is helpful to others.
I want to know how to show compilation errors in Android Studio. I tried the following one:
Android Studio: Where is the Compiler Error Output Window?
But it is showing another error:
javac: invalid target release: 1.8
Anybody who knows the actual solution please reply.
There is a 'Problems' view in the project window:
Just click on the drop down (Android setting is default) and select 'Problems'. Not comparable to eclipse problems view tough...
Using F2
In addition to what the other answers say, you can find errors by pressing F2 or Shift+F2. This is useful when you can't see the where the red indicator is on the side bar.
There's "Messages" tab in Android Studio. Complilation errors and warning go there. You can select it by pressing alt+0 (⌘+0 in OS X - a shortcut to View|Tool Windows|Messages).
I was looking for the "Problems" view that you can see in Eclipse when building projects. For that, you can go to Analyze -> Inspect Code
Where is the warnings view in Android Studio?
and then I clicked on "Group by Severity" so that I could see the warnings and errors.
In the toolbar, go to Analyze -> Inspect Code
After That, you will have the Inspection Results window with the detailed errors and warnings. see image:
Next / Previous highlighted error: F2/Shift + F2
Show descriptions of error at caret: Ctrl+F1
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.