簡體   English   中英

eclipse中的java.lang.NoClassDefFoundError

[英]java.lang.NoClassDefFoundError in eclipse

我打開一個Android項目,該項目在Market中,並且顯然可以,在Eclipse中,當我嘗試運行它時,該應用程序會產生運行時錯誤。

這是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();
        }
    }

謝謝

檢查您的項目設置。 在Java Build Path-> Order and Export選項卡中-應該檢查Android Private Libraries和Android Dependency。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM