我在Eclipse中打开一个Android项目,显然没问题,当我尝试运行它时,应用程序会产生运行时错误。
这是logcat:
06-19 09:33:37.337: E/AndroidRuntime(3047): FATAL EXCEPTION: main
06-19 09:33:37.337: E/AndroidRuntime(3047): java.lang.NoClassDefFoundError: com.uvigo.gti.PictoDroidLite.PantallaPrincipal$3
06-19 09:33:37.337: E/AndroidRuntime(3047): at com.uvigo.gti.PictoDroidLite.PantallaPrincipal.onCreate(PantallaPrincipal.java:196)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.Activity.performCreate(Activity.java:5104)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.os.Handler.dispatchMessage(Handler.java:99)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.os.Looper.loop(Looper.java:137)
06-19 09:33:37.337: E/AndroidRuntime(3047): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-19 09:33:37.337: E/AndroidRuntime(3047): at java.lang.reflect.Method.invokeNative(Native Method)
06-19 09:33:37.337: E/AndroidRuntime(3047): at java.lang.reflect.Method.invoke(Method.java:511)
06-19 09:33:37.337: E/AndroidRuntime(3047): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-19 09:33:37.337: E/AndroidRuntime(3047): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-19 09:33:37.337: E/AndroidRuntime(3047): at dalvik.system.NativeStart.main(Native Method)
这是冲突的OnCreate:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().addFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
setContentView(R.layout.pantallaprincipal);
pantalla = getWindowManager().getDefaultDisplay();
// Datos para poder guardar pictos en la memoria cache.
final int memoriaClass = ((ActivityManager) getBaseContext()
.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
final int tamanhoCache = pantalla.getWidth() * pantalla.getHeight()
* memoriaClass / 8;
memoriaCache = new LruCache(tamanhoCache)//THE CONFLICTIVE LINE {
protected int sizeOf(String key, Bitmap bitmap) {
return bitmap.getRowBytes() * bitmap.getHeight();
}
};
// ////////////////////////////////////////////////////
fondo = (LinearLayout) findViewById(R.id.pantallaPrincipal);
textoReproducido = (TextView) findViewById(R.id.textoTitulo);
gridPictos = (GridView) findViewById(R.id.gridPictos);
try {
Intent checkTTSIntent = new Intent();
checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE);
} catch (Exception e) {
e.printStackTrace();
}
}
由于
答案 0 :(得分:0)
检查您的项目设置。在Java Build Path中 - >订单和导出选项卡 - 应检查Android私有库和Android依赖项。