-1

I am new with JavaScript and Developement on Android. I installed Eclipse but I can't even run the "Hello World" program, included when you created a new project !

Please help me, I spent the two last days installing this IDE (even tried Android Studio), but there is always the same error :

Could not find Chwet.apk!

And there seems to be an error with the "R", like in setContentView(R.layout.activity_main)

Here is my code :

package com.example.chwet;
 import android.os.Bundle;
 import android.app.Activity;
 import android.view.Menu;
 public class MainActivity extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
 // Inflate the menu; this adds items to the action bar if it is present.
 getMenuInflater().inflate(R.menu.main, menu);
 return true;
 }
 }
M D
47.9k9 gold badges97 silver badges116 bronze badges
asked Jan 31, 2014 at 11:04
5
  • 1
    Try to clean your project go to Project menu in eclipse and clean your project and let me know whether the error is gone or not. Commented Jan 31, 2014 at 11:10
  • Possible duplicate of [stackoverflow.com/questions/885009/… Commented Jan 31, 2014 at 11:12
  • 1
    Did you mean "I am new to Java and Eclipse"? Can you start simple Java applications (non-Android) from within eclipse? Do you have the JDK installed or just the JRE? What does the Eclipse error log say? Commented Jan 31, 2014 at 11:17
  • I am new to both Java and Eclipse. The error log says : "R cannot be resolve as a variable" Commented Jan 31, 2014 at 11:19
  • Cleaning the project doesn't work either... Commented Jan 31, 2014 at 11:22

2 Answers 2

0

Instead of importing android R class , import R class with your package name.

answered Jan 31, 2014 at 11:33
Sign up to request clarification or add additional context in comments.

Comments

0

Press Ctrl+shift+o to add missing packages. It will automatically remove your errors.

vahid abdi
10.4k4 gold badges31 silver badges37 bronze badges
answered Jan 31, 2014 at 11:15

2 Comments

Didn't work, I am apparently up-to-date... But tanks ;)
Ok.. But keep that command in your mind. It will be useful in your application development

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.