Error in generated values.xml - android

I can't get my Android project to build any more. The first error comes up in a file located at PATH_TO_PROJECT/app/build/intermediates/res/merged/debug/values/values.xml and the error reads Error:(2251, 58) String types not allowed (at 'android:id' with value ''). That line is
<style name="Platform.ThemeOverlay.AppCompat" parent=""/>
But in the file, the line that has red text indicating an error is the first line after the <?ml line
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
with the part in quotes being red.
I also have a problem with my classes suddenly showing errors using R.id or R.menu or R.whatever, though I'm sure that's something that is a side result of the above issue.
I thought it might be that gradle was updated, but I haven't made any changes to the gradle app file, just updated from 2.2.0 to 2.2.2, would that have caused it?

Related

I had a runtime error when am trying to run an android studio code about resource extraction

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.

"Error: <item> inner element must either be a resource reference or empty" persists after fixing

I decided to upgrade Android Studio today against my own better judgment. After upgrading, building the project failed due to
Android resource compilation failed
Output: /home/username/AndroidStudioProjects/project/mobile/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:841: error: <item> inner element must either be a resource reference or empty.
Line 841 was an <item>.
So I removed all the <item> bodies in values.xml like so:
<item name="item_1" type="id">Item 1</item>
to
<item name="item_1" type="id"/>
This did not fix the problem, as the same error is being thrown. The traceback now refers to a <string> resource in my values.xml file. There are no <item>s in the file that aren't fixed, so now I'm stuck. I've also tried the usual invalidate caches & restart, sync with Gradle files, clean and build stuff to no avail.
Edit:
I quickly noticed that upon building the project, line 841 (from the first traceback) is dynamically changed to the old <item> style, thus throwing the Exception. The source code XML file is free of the bodies, but the build-generated XML file generates it with a body in the item elements.
Removing the body from these tags does nothing, as the body is re-added on runtime every single time.

why am I getting the error "error executing aapt "

I'm getting the error executing aapt :return code 1073741819 due to which
.apk file is not generated how to fix this. How to fix if r.java file is missing
It could be a syntax or formatting error in one of the XML files. I just got this error code (it's actually negative), and I checked all the #string references and they were OK. Eventually I figured out it was because of this item in a menu XML file:
<item
android:id="#+id/action_stop"
android:orderInCategory="100"
android:icon="#drawable/ic_action_stop"
android:showAsAction="ifRoom | withText"
android:title="#string/action_stop"/>
However, the spaces around the | apparently aren't valid (XML isn't Java...). Eclipse didn't catch it as an error, but aapt crashed without giving a reason when it saw it. Not particularly graceful handling, by both Eclipse and aapt. Removing the extra spaces made everything work.
The problem with missing entries in strings.xml apparently produces error code -1073741816, not -1073741819. You have to look closely, but the last digit is different.
I'm not saying the problem is definitely some sort of syntax error. But it's another possibility that could be investigated.
I got this error when I had deleted a #string entry that was being referenced in a menu node xml resource.
I had this error and spent time trying to find a solution.
Finally the solution for this error which is: -1073741819 ( check the digits ) was a library was missing from: Properties -> Android -> Library
I just added the missing libraries and got this error resolved.
I got the same problem. What helped me was changing the Project Build Target
Properties->Android->Project Build Target

First Android Project Errors

I'v just started building my first Android project with eclipse, according to Lynda's course Up and Running with PhoneGap.
When i try to run the project (like the demonstration on Lynda), i get the following error message:
"your project contains error(s), please fix them befor running your application."
Description Resource Path Location Type
error: Error: No resource found that matches the given name (at 'label' with value
'#string/app_name'). AndroidManifest.xml /android_project line 49
Android AAPT Problem error: Error: No resource found that matches the given name (at 'label'
with value '#string/app_name'). AndroidManifest.xml /android_project line 52 Android
AAPT Problem
The import org.apache.cordova cannot be resolved android_project.java
/android_project/src/com/example/android line 23 Java Problem
DroidGap cannot be resolved to a type android_project.java
/android_project/src/com/example/android line 25 Java Problem
The method onCreate(Bundle) of type android_project must override or implement a supertype
method android_project.java /android_project/src/com/example/android line 28 Java
Problem DroidGap cannot be resolved to a type android_project.java
android_project/src/com/example/android line 30 Java Problem
Config cannot be resolved android_project.java /android_project/src/com/example/android
line 32 Java Problem
Attached the error screenshot
I can guess what some of the error messages means, but i don't know how to solve them.
Any suggestion?
I'm using windows 8.
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
Thanks,
Liron
Check your strings.xml inside your project>res>values and add the string values you are going to use in your project.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="app_name">AppName</string>
</resources>
Plus, I think you need to update your .jar file of cordova.
You can download it from the phonegap github repo.
You can find the lib in the lib/android/ folder.
To create a new project, you can use the lilb/andoird/bin/create.bat file.
Don't forget to clean the project.
Hope this helps you.
I think You forgot to set the string values. I havenĀ“t read that tutorial, but there are some strings missin. Check the tutorial, You have to set some strings inside strings.xml in Your res/values folder
EDIT
go to folder inside Your project "res/values" and open strings.xml. Then begin a new line and put
<string name="example_string">This is an example!</string>
The first part "example_string" is the name of the string. This is to refer to this for example inside an xml layout. imagine You have a button in any xml layout:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/example_button"
android:text="#string/example_string"/> <-- here you refer to that string inside strings.xml
The second part "This is an example" is what will be appear on that button.
But I think it would be better if You learn the basics instead of starting with PhoneGap.
http://developer.android.com/training/basics/firstapp/index.html

Eclipse Android error

Vista 64; Eclipse 3-5-1.
I'm getting this error when I work on main.xml:
ERROR Error: No resource found that matches the given name (at 'text' with value '#string/get_text').
To eliminate variables I've created a new Android Project
Opened main.xml and pasted this in
When I hit save I get the above error in a red X next to the
This is related to a problem mentioned on this site. It's question # is 885009.
My project is set to automatically build.
Add this line in your string.xml
<string name="get_text">SAMPLE</string>

Categories

Resources