First Android Project Errors - android

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

Related

Error in generated values.xml

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?

How to fix "No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')"

I am getting the following error when I build my Android App project in Visual studio 2015.
No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
These lines are located under:
obj\Debug\android\manifest\AndroidManifest.xml
There is 3 entires of it inside the AndroidManifest file.
I have downloaded the google play service from the SDK Manager.
Should I reference anything to my solution?
I already has Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps Referenced.
Thanks.
you have create integer.xml file inside value folder and define your Integer to that place it will solve your problem.
Try doing and a clean all and check that ALL the content under the obj has been deleted and then perform a build all.
If that does not work:
I would try removing the ~GooglePlayServices~ nugets/references and re-add just the Xamarin.GooglePlayServices.Mapsnuget which will bring in the ~Basement and ~Base libraries.
You should end up with a generated manifest that only has one reference to google_play_services_version and that resource should be picked up from Debug/android/XXX/YYYYYY/ZZZZZ/R.java:
i.e.
public static final int google_play_services_version=0x7f070000;
I added several new packages. One of the package is the reason of the error. I have to check one by one and caught the one causing error. Removing that package is all I need to do to resolve the error.

Segmentation fault with aapt

Trying to build and Android project using Maven, we are not able to compile it with google play services apklib with it.
I've tried to remove all the languages from the apklib, just keeping the default one, and it seems to be able to execute aapt with no problems.
Does anybody run into this problem? I've tried to do what Jake Wharton says in this website: https://github.com/JakeWharton/gms-mvn-install , but the Segmentation fault still happening.
Ideas?
Thank you for your time.
aapt: warning: string 'error_generic_text_toast' has no default translation in /Users/fjfernandez/Development/android-messenger/app/target/unpack/apklibs/com.google.android.gms_google-play-services_apklib_5/res; found: ca_ES cs de en eu_ES fr gl_ES it nl pt pt_PT sk
Segmentation fault: 11
The problem we had in code was in style. You cannot use #+id to make reference to any view ( I guess you should not reference any kind of view in your styles, but anyway).
No #+id in your styles.
Maybe you already solved this problem, but I find out if I don't define in Manifest package like "package=some.app.package" it gave me the same error like you had.
I had a menu file with unresolved #string reference. I copied the aapt command from the Eclipse Console tab and ran it in a standalone terminal window. I figured out the offending file from the aapt log.
(new resource id main from /home/paller/workspaces/android_dev/xxxxxx/res/menu/main.xml)
Segmentation fault (core dumped)
It does not look nice that aapt just crashes if it does not like something in its input files.
I just found out that when strings.xml contains %blabla%, aapt segfaults. I have created an issue here: https://code.google.com/p/android/issues/detail?id=68667

no resource found that matches the given name Android 1.6

I've got 'no resource found that matches the given name' but everything is set up correctly.
error: Error: No resource found that matches the given name (at 'text' with value '#string/labReminderClear').
In AndroidManifest.xml:
<application android:label="MyName"
.....
In Strings.xml:
<string name="app_name">MyName</string>
...
<string name="labReminderClear">Clear</string>
What could be wrong?
The project you've mentiond contains errors in strings.xml file. It is connected with % sign used for example in following line (NOTE: there are multiple in that file):
<string name="msgYouHaveASTS">You have %d appointment(s)\n..and %d task(s)</string>
This is due to aapt (Android Asset Packaging Tool) becoming strict and being used for all versions of Android. See detailed explanation in this answer.
If you want to fix the code so that it works correctly, you have to add info about parameters positions. For example line from above should become:
<string name="msgYouHaveASTS">You have %1$d appointment(s)\n..and %2$d task(s)</string>
If you're using Eclipse try using (from menus above):
Project->Clean....
Select project, in which you have problem, to be rebuilt.
If that doesn't help Error Log view might help you nail what is the real issue here. From Eclipse menus choose:
Window->Show view->ErrorLog

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