I have this error when trying to make a module of a project
apply plugin: 'com.android.library'
android {
compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/sdk.jar')
compile files('libs/ads-lib.jar')
compile project(':google-play-services_lib')
compile files('libs/hdvdecoderandroid.jar')
}
How can i fix this error?
Edit
Here is my logs file, when i try to build it in command line
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':hDVietAndroid:m
ergeDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAct
ions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(Ex
ecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.exe
cute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(Skip
UpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(Valida
tingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.exec
ute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute
(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOn
lyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute
(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(Abstra
ctTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.ex
ecuteTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.pr
ocessTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.ru
n(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPla
nExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGr
aphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutio
nAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:6
2)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.jav
a:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java
:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionA
ction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:6
2)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:5
5)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLa
uncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher
.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.jav
a:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.
run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildA
ctionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildA
ctionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(
CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(
CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValida
tionAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValida
tionAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandL
ineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandL
ineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAc
tion.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAc
tion.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.jav
a:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.lang.RuntimeException: Crunching Cruncher vertbar.9.png failed, see logs
at com.android.builder.png.QueuedCruncher.waitForAll(QueuedCruncher.java:178)
at com.android.builder.png.QueuedCruncher.end(QueuedCruncher.java:190)
at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.jav
a:128)
at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:291)
at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:48)
at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources
.groovy:112)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(Incrementa
lTask.groovy:70)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$I
ncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:235)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$S
tandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$I
ncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:222)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$S
tandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAct
ion(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAct
ions(ExecuteActionsTaskExecuter.java:61)
... 47 more
I try to search in stackoverflow, but i can't find a correct answer for my case.
This question is related to
android
android-studio
android-gradle-plugin
build.gradle
Ok, I just faced this problem and tried all of the steps mentioned above but didn't help. So what I did, I checked what image extension it was before I renamed it to .png. In my case it was .jpeg. So I renamed it back to .jpeg and kept the same original file in drawable. And bingo, it just worked fine.
So the solution is, use the file without changing extension, be it .png or .jpeg, keep it the original way.
Thought to share if it helps anyone. Thanks.
I came here because i had this problem and non of the answers here helped me. For future user that could be helped here:
My problem was I did two 9-patch images for a switch button. Then I rezized that image without 9-patching them. To solve the issue I had to 9-patch all the images for all the drawable folders (xxhdpi, xhdpi and so on)
I had the same problem.
It was caused by a corrupted file. If you added some new Drawable before getting this error, check them to see if they are correctly display in Android Studio Viewer.
Sometimes, it can be caused by wrong naming for xml or resource file.
At least, for me, that problem was solved by changing name .
I have had this problem before with adding png files. I have discovered the problem with some of them since cleaning your project and closing AS does not solve every problem.
I did an experiment with GIMP when exporting images. Apparently, converting them to RGB fixes it. Some photos will be set to Indexed mode. Simply select Image>Mode>RGB. Then, export it and copy it into AS.
Clean the project and build it again
Close android studio and open it again. Then try compiling the same code. I was getting the same error and it worked for me. Hope it helps.
Today I also met this problem. Here is how I solved it:
xxx.9.png
. xxx9.png
and rebuilt. There were no errors, and the java files with the red wave under the name are gone too.It may happens because fake png files. You can use this command to check out fake pngs.
cd <YOUR_PROJECT/res/> && find . -name *.png | xargs pngcheck
And then,use ImageEditor(Ex, Pinta) to open fake pngs and re-save them to png.
Good luck.
I had faced this similar error too. In my case it was one of my picture files in my drawable
folder. Removing the picture that was unused solved the problem for me. So, make sure to remove any unused items from drawable
folder.
Additional to all answers, I think it could have similar problems. My Problem was caused by png.9 files. If this files, have a (in my case) too small stretching area with just a few pixels, the building failed with this error also. I have checked all these answers, but nothing helped. Giving a little bit bigger stretching area, solved the problem. I tested it many times, allways when I use small stretching areas it failed. So I am sure, it will help some poeple to make the stretch area a little bit bigger.
The second problem, but this is just an assumption, is the icon name (maybe only for png.9 files too). For examle, I used an image named folder_icon.9.png , with this one, it allways failed. Renaming it to other_folder_icon.9.png, it worked. So I think some names are used by the android system itself, maybe here is a problem too.
I had the same problem, but look at this image and I`m sure u can find the answer in such situation...the problem was in a png file. when I fixed what android studio asked me, it worked. I hope it works for U too. click this photo... it shows where is the problem and what it is
Even i had same problem,this solution helped me so it might help you
check build version is matching with compile sdk version and add below code inside android block of build.gradle
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
The problem might probably be due to the mismatch of the extension types given by the programmer and the actual extensions of the images present in the drawable folder of your app. or fixing this follow the steps given below:-
Step 1- Double click on each of the image resources and and check the extension i.e whether the image is png or jpeg or any other format.
Step 2- Now check if the same extension is given by you in the drawable folder dropdown in package explorer(a.k.a Android in Android Studio).
Step 3 - If the extensions are not matching then delete that image and paste another image of the same name in its place making sure the extension is matching with the actual extension of the image (for example, if the image is "a.png" then make sure the extension of the image given by you is also of .png type) .
Step 4 - Sync your gradle file and run the project. This time there should be no errors.
I faced the same error but i solved this by selecting invalidate caches/restart option.
Click
I have tried methods mentioned above, restarting the AS didn't work for me, and rebuilding didn't work either. Finally I found the problem was with the .9.png files, I deleted them and rebuilt the project, and it worked fine! Try it.
I was getting the same error and it worked for me. Hope it helps.
As Niklas said, you have to update to the latest Gradle version.
My way to solve the error:
build.gradle
file in your project.Change:
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
to:
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
Clean your project.
If its still not working:
If you need more help, read the issue on Google Code!
This could also some extra reasons instead of the mentioned reasons :
I was also stuck by this problem.But in my case I delete all .png
images from drawable
folder ,clean and rebuild
application and then paste all .png
images to my drawable
, rebuild again. It worked fine for me.
You can get this error if you have invalid 9-patch files. If there is anything apart from black and transparent in the border pixels you will get this error. The easiest way of fixing this is to open it up in Android Studio and modify the borders. Just adding and removing one pixel is enough.
It's worth noting that you won't see the bad pixels in AS, as the editor sets anything not black to transparent, but you will need to modify the file for it to save these changes.
Source: Stackoverflow.com