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;
}
}
-
1Try 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.InnocentKiller– InnocentKiller2014年01月31日 11:10:11 +00:00Commented Jan 31, 2014 at 11:10
-
Possible duplicate of [stackoverflow.com/questions/885009/…Harish Talanki– Harish Talanki2014年01月31日 11:12:16 +00:00Commented Jan 31, 2014 at 11:12
-
1Did 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?Axel– Axel2014年01月31日 11:17:24 +00:00Commented 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"Nickel_Chrome– Nickel_Chrome2014年01月31日 11:19:23 +00:00Commented Jan 31, 2014 at 11:19
-
Cleaning the project doesn't work either...Nickel_Chrome– Nickel_Chrome2014年01月31日 11:22:57 +00:00Commented Jan 31, 2014 at 11:22
2 Answers 2
Instead of importing android R class , import R class with your package name.
Comments
Press Ctrl+shift+o to add missing packages. It will automatically remove your errors.