user1653134
user1653134

Reputation: 13

Android First App tutorial not working

I'm following the Android developers tutorial to build the first application. I did precisely what it says step by step and completed this page: https://developer.android.com/training/basics/firstapp/starting-activity.html

Here I get many Java related errors:

Description                               Resource             Path                             Location    Type
View cannot be resolved to a type   MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 24 Java Problem
Intent cannot be resolved to a type MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 25 Java Problem
Intent cannot be resolved to a type DisplayMessageActivity.java /MyFirstApp/src/com/example/myfirstapp  line 16 Java Problem
TextView cannot be resolved to a type   DisplayMessageActivity.java /MyFirstApp/src/com/example/myfirstapp  line 20 Java Problem
TextView cannot be resolved to a type   DisplayMessageActivity.java /MyFirstApp/src/com/example/myfirstapp  line 20 Java Problem
Intent cannot be resolved to a type MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 25 Java Problem
EditText cannot be resolved to a type   MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 26 Java Problem
EditText cannot be resolved to a type   MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 26 Java Problem
edit_message cannot be resolved or is not a field   MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 26 Java Problem

Any help please?

EDIT: @pawalzieba Ok, now I get only these 3 errors:

Description Resource    Path    Location    Type
edit_message cannot be resolved or is not a field   MainActivity.java   /MyFirstApp/src/com/example/myfirstapp  line 29 Java Problem
error: Error: No resource found that matches the given name (at 'hint' with value '@string/edit_message').  activity_main.xml   /MyFirstApp/res/layout  line 6  Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '@string/button_send').   activity_main.xml   /MyFirstApp/res/layout  line 11 Android AAPT Problem

Upvotes: 1

Views: 12627

Answers (2)

user2104058
user2104058

Reputation: 31

error: Error: No resource found that matches the given name (at 'hint' with value '@string/edit_message').  activity_main.xml   /MyFirstApp/res/layout  line 6  Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '@string/button_send').   activity_main.xml   /MyFirstApp/res/layout  line 11 Android AAPT Problem

Try to add to strings.xml:

<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>

Upvotes: 3

pawelzieba
pawelzieba

Reputation: 16082

In Eclipse: Right click on project in Package Explorer tab -> "Properties" in dialog -> "Java Build Path" in left menu -> "Source" tab

There you can change source folder. Set it to point on src folder in your project.


EDIT

Missing imports in java files. Press in Eclipse this shortcut Ctrl+Shift+O to organize imports.

Upvotes: 0

Related Questions