Android studio How to resolve Error in png files of library added - android

I have no Idea what is happening, last time when I finished my app I build its release apk and all was working just fine as expected but now today when I tried to make that pproject again and to make another apk I am getting the following error.
Error:Execution failed for task ':app:mergeDebugResources'.
Crunching Cruncher common_signin_btn_icon_pressed_light.9.png failed, see logs
I have no idea how to resolve it I have serached and found restarting Android studio and clean the project would remove it , doing this many times has no effect on this error. I have even restarted my machine but the condition of error in same.
In the logs I have seen that this png file is from the library I added , so just for testing I removed that library and tried to build then it started to give me same error with different png file name in other library. So how to fix this issue ?
My Questions are :
How can this issue be Solved ?
Have some one faced this problem too ?
Is this problem has been reported to google ?
Why in android we do not have any stable platform for development as IOS have ?

Try to remove "builds" folders and do rebuild. But soon, the whole thing in a long file name. Read this answer. By the way, you looked logs? Maybe this is not the PNG? You have not sent the log and did not specify the version Gradle.
Believe me, iOS developers have own problems.

Related

Upgrading to Gradle 7.1.1 in Android Studio Breaks Build

After upgrading to Gradle 7.1.1, I get the following build error:
Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
I've done as many Google searches as I could but can't find anything on this. I've tried running the build with stacktrace, debug and scan options but there is nothing in the output window that gives a hint as to where this is coming from, except that it's in this task:
app:mergeProductionDebugResources FAILED
I'm assuming there is some file somewhere that's doing this but I don't know how to begin finding it.
I would like to know if there is some place to look that I'm not aware of, or if there is some procedure to help me track this down.
I found my issue. Someone had added an empty xml file to the project. Previous versions of gradle just ignored this, but 7.1.1 doesn't.

Android Studio Execution failed for task ':app:mergeDebugResources' with special chars in username

i have a strange error with AAPT2 iin Android Studio. I think it has something to do with german special characters in my account name in windows.
If i set my gradle to version 3.0.1 and also set android.enableAapt2 to false everything works fine. But since i researched, setting the option is not a solution to the problem.
Now if i set the gradle version to 3.1.2 and remove android.enableAapt2 from the properties i get the following error message:
And this one:
One way to solve the problem was to create a new account in windows without special chars in the name. It compiled and did run very well. I really tried everything in the web but could not find a solution to the problem.
Maybe you can help me.
First of all check your build log botom of the build section you shared whether any error related to your project showing or not. If error showing then fix those. Build and run again and fix all the error comes up. It will eliminate aapt2 issue without changing android gradle plugin.
Secondly if there is not any project related error showing in the build log but still its showing aapt2 error then you can fix it by following below steps.
Update your android gradle plugin in your project level build.gradle file like below:
classpath 'com.android.tools.build:gradle:3.2.0-alpha13'
Now update android.enableAapt2=true. Then check and build your project.

Android studio 3.0 Beta4 can't rename a file and build error sometimes

Rename Error :
Build Error :
Error:Execution failed for task
':app:transformDexWithInstantRunSlicesApkForDebug'.
java.io.IOException: Could not delete path 'D:\AndroidStudioWorkSpace\qianfan-android\app\build\intermediates\instant-run-support\debug\package_slice_7\dex-renamer-state.txt'.
This is a known issue, which, per the last comment:
Beta 4 doesn't include the fix. It will be in beta 5.
I've got this same problem happening to a multidex apk using 3.0.1 My project is far from trivial so I have no idea where to go with this beyond just doing a stupid clean whenever it happens.... no rhyme or reason behind it as best as I can tell.

Seeing errors in Android Studio 2.1.2

I'm an Android Studio noob and I'm confused about how it reports errors. I have a fairly large Android project - about 25 java source files - mostly Activities - and a similar number of XML files.
I do a Build > Clean Project and a Build > Rebuild Project, and the Gradle Console reports BUILD SUCCESSFUL. In the Messages tab it says:
BUILD SUCCESSFUL
Total Time 4.368 seconds
0 errors
0 warnings
But if I actually open up an XML file, e.g., the Android manifest.xml file, I see errors marked in red, such as
Cannot resolve symbol 'PlyListActivity'
and
Cannot resolve symbol 'ActivityMsgClass'
... those seem like errors to me. Yet the Android manifest.xml file is not marked or highlighted in any way in the UI - if I hadn't opened it in the editor I wouldn't have seen those errors. So short of opening up each of the 25 XML files in my project, how can I find out about such errors when I do a build?
Edit: Just to be clear - my question is not about what causes the errors listed in the manifest. My question is why does the build show 0 errors and 0 warnings, and is there any way in Android Studio to be aware of these errors/warnings short of having to open up each and every file (25 in my case) in the editor to look for them?
This is a very annoying bug, and it's been around forever. Unfortunanetly, there is no way you can fix it, this doesn't only happen to the Manifest but to the resources XML files too. However, your app will crash if there is a real error, not a warning.
However, there could be a way if you mess around Android Studio, I couldn't find this, but maybe you could:
Go to Android Studio. Go to File>Settings, alternatively press CTRL+ALT+S
Go to Editor>Inspections,now here, you can change all the errors in Android Studio to a warning, or nothing and vise-versa. This could solve your problem if you find your error in this window and disable it (Make sure it is Manifest Only). Otherwise, I hate to say the answer even for myself, there is no solution.
UPDATE: If you go to Analyze>Inspect Code you can see all your errors and warnings in your project.
This is not an error. This show both the class are not defined in your project as activity, but you have still defined in manifest as activity.
If you run the 'lint' gradle task, it should generate an webpage that details all the warning/error/issues it detects during build time.
Ran lint on variant debug: 11 issues found
Ran lint on variant release: 11 issues found
Wrote HTML report to file:///C:/Android/JsoupExample/app/build/outputs/lint-results-debug.html
Wrote XML report to file:///C:/Android/JsoupExample/app/build/outputs/lint-results-debug.xml

Android Packaging Problem: resources.ap_ does not exist

I am trying to fix a problem in Eclipse for like 3 hours and I haven't made any progress. Tomorrow is the customer coming to look at my app, and I have no time left. This is really frustrating!
This morning when I was coding and I wanted to run my app on my device Eclipse crashed all of a sudden. 'aapt.exe has stopped working'
After this Eclipse wasn't starting anymore. It froze at the splash image.
I looked on the internet and tried different solutions like going back to Java SE 6 update 20, changing .ini file etc. in the end reinstalling Eclipse did the job.
Shortly after that the 'aapt.exe has stopped working' returned. I found a solution by changing my projects target. 1.5, 1.6, 2.2 doesn't matter, as long as it's different than the one before.
Now I get the Error generating final archive: java.io.FileNotFoundException: C:\xxx\bin\resources.ap_ does not exist error.
I tried clean but that doesn't work. Deleting and automatically regenarting R.java also didn't work.
I ran the same code in Netbeans with the Android plugin and there it gives me the 'aapt.exe has stopped working' again :(
Please guys, how can I fix this?
Edit:
I think I may have found the reason. These are the error lines in the console:
org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: <bitmap> requires a valid src attribute
at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:341)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:779)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:720)
at com.android.layoutlib.bridge.ResourceHelper.getDrawable(ResourceHelper.java:150)
at com.android.layoutlib.bridge.BridgeTypedArray.getDrawable(BridgeTypedArray.java:668)
at android.view.View.<init>(View.java:1846)
at android.view.View.<init>(View.java:1795)
at android.view.ViewGroup.<init>(ViewGroup.java:282)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
[2011-01-17 16:37:20 - gegevens.xml] Unable to resolve drawable "com.android.layoutlib.utils.ResourceValue#267e33de" in attribute "background"
The file it's talking about is 'bg.png'. It's a small png file which I repeat in a .xml file.
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/bg" android:tileMode="repeat" />
This file has worked from the first time without any problems.
I deleted it from the drawable folder, waited for an error message, and then added it back. The red x next to the foldername got away, but still nothing different...
A shot in the dark, but if it's just the one PNG file could you delete it from the project and add it back? There must be something breaking the resources file.
I just encountered the same error after performing an SDK update withing Eclipse (Indigo). Normally I would either delete the errors and try to rebuild or clean with success, however this time it didn't fix the problem.
Finally I went to the android sdk folder and manually updated. Upon coming back into eclipse I got the error again, but without rebuilding or cleaning I was able to launch the application onto the device by pressing play for a second time.
EDIT:Apparently this problem is intermittent, as I am now once again unable to run on the device, or export the signed apk.
SOLVED: The problem stems from a corruption in the .metadata folder. I discovered this by re-installing Indigo, but when doing so I didn't remove the original workspace folder. The problem of course showed up again. I deleted the .metadata folder completely, which effectively resets all of your eclipse configuration settings. All deployments and signing work flawlessly now. Just had to setup the environment to my liking again, which takes a few minutes as opposed to the hours I spent troubleshooting this.
I just ran into this same problem after importing my project from another machine, but didn't have any errors in the console like the OP. I unchecked Project->Build Automatically and then did Project->Clean and this solved my problem. I was actually missing several files in the bin/ directory for my project and this fixed them all.
I think this error can come up for a variety of reasons. The following solution is only known to be specific to the same error message appearing when using ADT 14 (released yesterday) with build output set to Verbose:
I ran into the same error using Eclipse 3.7 (Indigo) after upgrading to ADT 14 and SDK 14 on all projects including newly created ones. I found a workaround someone posted on the ADT bug tracker, which is basically to switch Eclipse Settings->Android->Build->Build Output from "Verbose" to "Normal". The post is here.
In my scenario, yesterday upon open Eclipse was trying to download updates and I cancelled it since I was using my cellphone hotspot. I tried the metadata folder delete solution mentioned here and didn't work for me. Going to Window->SDK Manager and updating everything seems to be my solution.
I had the same issue in that I added some images into each resource directory and unfortunately named them .png. There were in fact jpegs and the eclipse plugin was flagging this (unbeknown to me in the console)
The issue I found was that if you clear the console then the logging info is lost and it doesn't log anything again!
Changing the extension from .png to .jpg fixed my issue
Above solution didn't worked for me.
The way I did that is updating not only ADT but SDK as well. To do that just go to Android SDK Manager and just download updates.
IT WORKS!
It's very meaningless but changing build mode from verbose to silent did the trick! Nothing else (cleaning project, re-opening , re-installing) did.
Try running clean, but also uncheck build automatically and click "build project" under the "Project" menu. Once you build manually, you can re-check the "build automatically".
I would also shutdown eclispe, and then kill adb
> adb kill-server
Sometimes this error happens when you create ninepatch with wrong black dots/lines. For example right and bottom lines must be solid with no dashes or empty regions.
Try in
windows-> peferences -> android -> Build -> Build Output
Silent
http://code.google.com/p/android/issues/detail?id=20395
In some cases, this error will disappear after fixing upstream errors. In my case that was a version incompatibility in 'fullwebview.xml'.
There, 'layout_width'/height was set to a value not supported in my build target, 2.1. Changing the value to 'fill_parent' solved the issue.
I encountered this same error but then I saw that my layout.xml was not catching an error for a TextView whose android:text="#string/my_unmapped_string string resource was not mapped in strings.xml. So when I viewed the graphical layout it was showing:
Couldn't resolve .....
When I mapped the resource properly and ran the project again, it worked fine and that bin\resources.ap_ does not exist error was gone :)
In my case, it was the file add-icon.175x175-75.png (valid file name, but invalid resource name) copied into res/drawable by mistake. After removing this file, Eclipse did (in April 2015) a few successful builds with incorrect sources, and only then began to behave sensibly, showing me missing resources and malformed XML (I changed the layout).

Categories

Resources