So im trying to save an image in one of the drawable folders in my android problem but no matter where i put the image file, trying to build or run my program gives this error
C:\Users\*****\AppData\Local\Android\android-sdk\tools\ant\build.xml:621: The following error occurred while executing this line:
C:\Users\******\AppData\Local\Android\android-sdk\tools\ant\build.xml:657: null returned: 1
the offending lines of code are:
621-elseText="hasCode = false. Skipping aidl/renderscript/R.java">
657-proguardFile="${out.absolute.dir}/proguard.txt">
As soon as i remove the image file my application cleans and builds and runs with no problems. What am i doing wrong?
Upper case letters are not allowed in resource file names. Did you verify?
Related
This is the error when I run the code -> Can not extract resource from com.android.aaptcompiler.ParsedResource#16fb6dec.
I have tried to edit the strings.xml file, changing string values, but when I rerun the code, I still get the same error
I also followed the steps posted by previous but it doesn't work out for me.
I am getting this error while building my app. The drawable folder has the valid .jpg file and this is causing the error. How to bypass this? Also, I noticed that the path shown in the error is "main\res\routine\Routine.jpg", but there is no such folder in the project.
AGPBI: {"kind":"error","text":"The file name must end with .xml",
"sources":[{"file":"C:\\Users\\Lenovo\\AndroidStudioProjects\\project3\\app\\src\\main\\res\\routine\\Routine.JPG"}],
"tool":"Resource and asset merger"}```
UPDATE: solved the problem by reuploading the pic and saving it in drawable_V21. still dont know about that error message though. might be a bug
I guess that error you're experiencing is because of the file extension being in .JPG instead of .jpg try changing it. It may help somehow
I can't find a way to add images to drawable folder without getting "Cannot resolve symbol R" issue.
And once i get "Cannot resolve symbol R", I can't get rid of it by either clean, rebuild, sync, invalidate cache & restart solutions for the error. Only if i delete the files can I get the build to pass.
I am not sure what is wrong here.
Note: I am on Android Studio 2.1.1
I had exactly the same problem, and it was that I downloaded an "image.jpeg" extension from Internet and directly changed the extension saving it like "image.png", but Android studio still recognized it like image.jpeg.
I realized that when using top menu Analyze-Inpect code.
Once the inspection is finished a new window called 'Inspection' appears and in the follow carpets appears next:
Android > Lint > Usability > Icons
Icon format does not match the file extension
Misleading file extension; named .png but the file format is JPEG*
You are facing this issue because your drawable file name is either
having any capital letter or starting with a number or containing any special character like #,*,$ etc. rename it the
error will be gone.
You can use only small letters, underscore(_), numbers(not at beginning) & dot(.) in the name of drawable
For example the name could be ABC.png then rename it to abc.png and it will work.
1xYz.JPEG then rename it to _1xyz.jpeg
a#b.png then rename it to ab.png
After that clean and rebuild & there you Go..!!
I found that the extension of the file must match the actual format of the image.
For example, you will get this error if you changed the extension of an image from bmp to png and added it to the project
Generally, AAPT is packaging an application with fixed resource id, and the id value is starting with "0x7f".
I want to replace this integer value with other value, like "0x6f" or something.
I found the code line to handle this, and modified the aapt code. (path : /frameworks/base/tools/aapt/)
But, when building an application, I got the build error message like:
/apps/myapps/AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'icon' with value '#drawable/ic_launcher_app')."\
Is there any way to solve this build error ?
According to this Android resources dev page you should never modify the R file yourself as it is generated automatically
Caution: You should never modify the R.java file by hand—it is generated by the aapt tool when your project is compiled. Any changes are overridden next time you compile.
That means ic_launcher_app image not in your drawable folder. And also if you change image format manually like .jpg to save as .Png without using any software that AAPT(while compile resources into binary assets) issue will occur.so use proper image formats.
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.