Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 不幸的是,应用程序已停止android emulator_Java_Android - Fatal编程技术网

Java 不幸的是,应用程序已停止android emulator

Java 不幸的是,应用程序已停止android emulator,java,android,Java,Android,这是日志,我在AVD中收到类似的消息-不幸的是,已停止,请帮助我解决此错误,我想在android中了解更多信息,但被此错误所吸引 07-09 23:47:26.270: D/dalvikvm(831): Not late-enabling CheckJNI (already on) 07-09 23:47:29.460: I/Choreographer(831): Skipped 100 frames! The application may be doing too much work on

这是日志,我在AVD中收到类似的消息-不幸的是,已停止,请帮助我解决此错误,我想在android中了解更多信息,但被此错误所吸引

07-09 23:47:26.270: D/dalvikvm(831): Not late-enabling CheckJNI (already on)
07-09 23:47:29.460: I/Choreographer(831): Skipped 100 frames!  The application may be doing too much work on its main thread.
07-09 23:47:30.160: D/gralloc_goldfish(831): Emulator without GPU emulation detected.
07-09 23:47:56.200: D/WiFiChangeBroadcastReceiver(831): WiFi Status Changed
07-09 23:47:56.530: D/WiFiChangeBroadcastReceiver(831): WiFi Status Changed
07-09 23:48:45.670: I/Choreographer(831): Skipped 222 frames!  The application may be doing too much work on its main thread.
07-09 23:48:45.810: I/Choreographer(831): Skipped 39 frames!  The application may be doing too much work on its main thread.
07-09 23:48:45.980: I/Choreographer(831): Skipped 212 frames!  The application may be doing too much work on its main thread.
07-09 23:48:50.760: I/Choreographer(831): Skipped 190 frames!  The application may be doing too much work on its main thread.
07-09 23:48:53.120: D/AndroidRuntime(831): Shutting down VM
07-09 23:48:53.120: W/dalvikvm(831): threadid=1: thread exiting with uncaught exception (group=0xb2aeaba8)
07-09 23:48:53.130: E/AndroidRuntime(831): FATAL EXCEPTION: main
07-09 23:48:53.130: E/AndroidRuntime(831): Process: com.example.beaglem, PID: 831
07-09 23:48:53.130: E/AndroidRuntime(831): java.lang.RuntimeException: Unable to pause activity {com.example.beaglem/com.example.beaglem.FullscreenActivity}: java.lang.NullPointerException
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3062)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3017)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2995)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.access$1000(ActivityThread.java:135)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.os.Handler.dispatchMessage(Handler.java:102)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.os.Looper.loop(Looper.java:136)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.main(ActivityThread.java:5017)
07-09 23:48:53.130: E/AndroidRuntime(831):  at java.lang.reflect.Method.invokeNative(Native Method)
07-09 23:48:53.130: E/AndroidRuntime(831):  at java.lang.reflect.Method.invoke(Method.java:515)
07-09 23:48:53.130: E/AndroidRuntime(831):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-09 23:48:53.130: E/AndroidRuntime(831):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-09 23:48:53.130: E/AndroidRuntime(831):  at dalvik.system.NativeStart.main(Native Method)
07-09 23:48:53.130: E/AndroidRuntime(831): Caused by: java.lang.NullPointerException
07-09 23:48:53.130: E/AndroidRuntime(831):  at com.example.beaglem.FullscreenActivity.onPause(FullscreenActivity.java:185)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.Activity.performPause(Activity.java:5335)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1233)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3048)
07-09 23:48:53.130: E/AndroidRuntime(831):  ... 12 more
07-09 23:57:25.030: D/gralloc_goldfish(1132): Emulator without GPU emulation detected.
07-09 23:57:25.490: I/Choreographer(1132): Skipped 297 frames!  The application may be doing too much work on its main thread.
07-09 23:57:25.660: I/Choreographer(1132): Skipped 200 frames!  The application may be doing too much work on its main thread.
07-09 23:47:26.270: D/dalvikvm(831): Not late-enabling CheckJNI (already on)
07-09 23:47:29.460: I/Choreographer(831): Skipped 100 frames!  The application may be doing too much work on its main thread.
07-09 23:47:30.160: D/gralloc_goldfish(831): Emulator without GPU emulation detected.
07-09 23:47:56.200: D/WiFiChangeBroadcastReceiver(831): WiFi Status Changed
07-09 23:47:56.530: D/WiFiChangeBroadcastReceiver(831): WiFi Status Changed
07-09 23:48:45.670: I/Choreographer(831): Skipped 222 frames!  The application may be doing too much work on its main thread.
07-09 23:48:45.810: I/Choreographer(831): Skipped 39 frames!  The application may be doing too much work on its main thread.
07-09 23:48:45.980: I/Choreographer(831): Skipped 212 frames!  The application may be doing too much work on its main thread.
07-09 23:48:50.760: I/Choreographer(831): Skipped 190 frames!  The application may be doing too much work on its main thread.
07-09 23:48:53.120: D/AndroidRuntime(831): Shutting down VM
07-09 23:48:53.120: W/dalvikvm(831): threadid=1: thread exiting with uncaught exception (group=0xb2aeaba8)
07-09 23:48:53.130: E/AndroidRuntime(831): FATAL EXCEPTION: main
07-09 23:48:53.130: E/AndroidRuntime(831): Process: com.example.beaglem, PID: 831
07-09 23:48:53.130: E/AndroidRuntime(831): java.lang.RuntimeException: Unable to pause activity {com.example.beaglem/com.example.beaglem.FullscreenActivity}: java.lang.NullPointerException
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3062)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3017)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2995)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.access$1000(ActivityThread.java:135)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.os.Handler.dispatchMessage(Handler.java:102)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.os.Looper.loop(Looper.java:136)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.main(ActivityThread.java:5017)
07-09 23:48:53.130: E/AndroidRuntime(831):  at java.lang.reflect.Method.invokeNative(Native Method)
07-09 23:48:53.130: E/AndroidRuntime(831):  at java.lang.reflect.Method.invoke(Method.java:515)
07-09 23:48:53.130: E/AndroidRuntime(831):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-09 23:48:53.130: E/AndroidRuntime(831):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-09 23:48:53.130: E/AndroidRuntime(831):  at dalvik.system.NativeStart.main(Native Method)
07-09 23:48:53.130: E/AndroidRuntime(831): Caused by: java.lang.NullPointerException
07-09 23:48:53.130: E/AndroidRuntime(831):  at com.example.beaglem.FullscreenActivity.onPause(FullscreenActivity.java:185)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.Activity.performPause(Activity.java:5335)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1233)
07-09 23:48:53.130: E/AndroidRuntime(831):  at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3048)
07-09 23:48:53.130: E/AndroidRuntime(831):  ... 12 more
07-09 23:57:25.030: D/gralloc_goldfish(1132): Emulator without GPU emulation detected.
07-09 23:57:25.490: I/Choreographer(1132): Skipped 297 frames!  The application may be doing too much work on its main thread.
07-09 23:57:25.660: I/Choreographer(1132): Skipped 200 frames!  The application may be doing too much work on its main thread.
这是我的主要java语言 '私有静态最终布尔自动隐藏=true

/**
 * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
 * user interaction before hiding the system UI.
 */
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;

/**
 * If set, will toggle the system UI visibility upon interaction. Otherwise,
 * will show the system UI visibility upon interaction.
 */
private static final boolean TOGGLE_ON_CLICK = true;

/**
 * The flags to pass to {@link SystemUiHider#getInstance}.
 */
private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;

/**
 * The instance of the {@link SystemUiHider} for this activity.
 */
private SystemUiHider mSystemUiHider;



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_fullscreen);

    final View controlsView = findViewById(R.id.fullscreen_content_controls);
    final View contentView = findViewById(R.id.fullscreen_content);

    // Set up an instance of SystemUiHider to control the system UI for
    // this activity.
    mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS);
    mSystemUiHider.setup();
    mSystemUiHider
            .setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
                // Cached values.
                int mControlsHeight;
                int mShortAnimTime;

                @Override
                @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
                public void onVisibilityChange(boolean visible) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
                        // If the ViewPropertyAnimator API is available
                        // (Honeycomb MR2 and later), use it to animate the
                        // in-layout UI controls at the bottom of the
                        // screen.
                        if (mControlsHeight == 0) {
                            mControlsHeight = controlsView.getHeight();
                        }
                        if (mShortAnimTime == 0) {
                            mShortAnimTime = getResources().getInteger(
                                    android.R.integer.config_shortAnimTime);
                        }
                        controlsView.animate()
                                .translationY(visible ? 0 : mControlsHeight)
                                .setDuration(mShortAnimTime);
                    } else {
                        // If the ViewPropertyAnimator APIs aren't
                        // available, simply show or hide the in-layout UI
                        // controls.
                        controlsView.setVisibility(visible ? View.VISIBLE : View.GONE);
                    }

                    if (visible && AUTO_HIDE) {
                        // Schedule a hide().
                        delayedHide(AUTO_HIDE_DELAY_MILLIS);
                    }
                }
            });

    // Set up the user interaction to manually show or hide the system UI.
    contentView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (TOGGLE_ON_CLICK) {
                mSystemUiHider.toggle();
            } else {
                mSystemUiHider.show();
            }
        }
    });

    // Upon interacting with UI controls, delay any scheduled hide()
    // operations to prevent the jarring behavior of controls going away
    // while interacting with the UI.
    //findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

    // Trigger the initial hide() shortly after the activity has been
    // created, to briefly hint to the user that UI controls
    // are available.
    delayedHide(100);
}
//----------------------------------------------------------------------------//

MediaPlayer playMusic;

@Override

protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();

    //To check the Network Name or other info:
    //WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    //WifiInfo wifiInfo = wifiManager.getConnectionInfo();
    //int ipAddress = wifiInfo.getIpAddress();

//  @SuppressWarnings("deprecation")
    //String ipaddress = Formatter.formatIpAddress(ipAddress);
    //{
    //try{
        //if("192.168.0.150".equals(ipaddress) );

        //try 
        //{ 
            //playMusic = new MediaPlayer();

            //playMusic.setDataSource("http://192.168.0.134/audio/bbb1.php");


          // playMusic.setOnPreparedListener(OnPreparedListener) this);

          // playMusic = MediaPlayer.create(this, R.raw.testing);
          // playMusic.prepare();
          // playMusic.start();


        }

    //}




@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();

    playMusic.release();
}




/**
 * Touch listener to use for in-layout UI controls to delay hiding the
 * system UI. This is to prevent the jarring behavior of controls going away
 * while interacting with activity UI.
 */
View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        if (AUTO_HIDE) {
            delayedHide(AUTO_HIDE_DELAY_MILLIS);
        }
        return false;
    }
};

Handler mHideHandler = new Handler();
Runnable mHideRunnable = new Runnable() {
    @Override
    public void run() {
        mSystemUiHider.hide();
    }
};

/**
 * Schedules a call to hide() in [delay] milliseconds, canceling any
 * previously scheduled calls.
 */
private void delayedHide(int delayMillis) {
    mHideHandler.removeCallbacks(mHideRunnable);
    mHideHandler.postDelayed(mHideRunnable, delayMillis);
}
}

原因是,除了onPause方法中的
playMusic.release()
代码外,所有的
playMusic
代码都被注释掉了。您应该能够注释掉该行并使其正常工作

如果查看日志Cat文件中的堆栈跟踪,您将看到以下行:

07-09 23:48:53.130: E/AndroidRuntime(831):  at com.example.beaglem.FullscreenActivity.onPause(FullscreenActivity.java:185)

这一行告诉我发生空指针异常的位置(查看您的代码,很明显,
playMusic
从未被设置,因此它是空的)。

Post logcat和“activity\u fullscreen.xml”代码同样,您的用户名不能准确反映歌词;-)@Anil我更新了我的问题thanks@geet这是我的日志。你能显示FullscreenActivity.java第185行吗??