0

我有一个在 Android 模拟器中运行良好且没有错误的应用程序:

  • 2.1
  • 2.3.3
  • 4.03

它在我的 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);
      } 
    });
  }
}

来自 Google Play 的堆栈跟踪:

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)
4

0 回答 0