我有一个适用于Android的模拟器中没有错误的应用程序:
它在我的4.03触控板上也能正常工作。
但是,Google Play崩溃错误报告显示:
main_menu中的错误。< init>()26报告
(注意:打开/关闭胡萝卜和'init'之间没有空格,但stackoverflow不允许我这样做)
一位用户通过电子邮件发送给我,并说他的三星Galaxy S运行2.3.3,并说它在启动时崩溃而没有任何错误。
这是main_menu.java的代码段。老实说,我不知道从哪里开始。 。 。任何想法?
ps - 我是一个弱的Android程序员,所以请善待并详细介绍。 。package robot_calc.android;
import sor.robotics.calculators.R;
import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.widget.Button;
import android.view.View;
public class main_menu extends Activity
{
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.main_menu);
Button bOhm = (Button) findViewById(R.id.btnOhmClick);
Button bLed = (Button) findViewById(R.id.btnLedClick);
Button bBat = (Button) findViewById(R.id.btnBatClick);
Button bEnc = (Button) findViewById(R.id.btnEncClick);
bOhm.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i = new Intent(main_menu.this, ohm_calculator.class);
startActivity(i);
}
});
bLed.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i = new Intent(main_menu.this, led_calculator.class);
startActivity(i);
}
});
bBat.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i = new Intent(main_menu.this, battery_calculator.class);
startActivity(i);
}
});
bEnc.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent i = new Intent(main_menu.this, encoder_calculator.class);
startActivity(i);
}
});
}
}
java.lang.Error: Unresolved compilation problems:
The import sor.robotics.calculators.R cannot be resolved
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
R cannot be resolved to a variable
at robot_calc.android.main_menu.<init>(main_menu.java:8)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1409)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)