Android studio 安卓工作室闪屏停止

Android studio 安卓工作室闪屏停止,android-studio,splash-screen,Android Studio,Splash Screen,每次我运行emulator并运行应用程序时,android studios闪屏都会出现这个问题,它会在闪屏后停止。我的SplashScreen.java代码与我从其他人那里看到的代码相比看起来不错。我相信问题在清单上,但似乎无法解决。logcat没有显示任何问题。我只是卡住了,所以任何帮助都将不胜感激 ?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/ap

每次我运行emulator并运行应用程序时,android studios闪屏都会出现这个问题,它会在闪屏后停止。我的SplashScreen.java代码与我从其他人那里看到的代码相比看起来不错。我相信问题在清单上,但似乎无法解决。logcat没有显示任何问题。我只是卡住了,所以任何帮助都将不胜感激

?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mook.bodyshop">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="Don's Body Shop"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".SplashScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="com.example.mook.bodyshop.MainActivity"></activity>
</application>
这是我的MainActivity.java

package com.example.mook.bodyshop;

import android.os.Bundle;  
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}
}
最后是logcat

05-20 20:55:56.809 2826-2826/? I/art: Not late-enabling -Xcheck:jni (already on)
05-20 20:55:56.811 2826-2826/com.example.mook.bodyshop W/art: Unexpected CPU variant for X86 using defaults: x86
05-20 20:55:56.912 2826-2826/com.example.mook.bodyshop W/System: ClassLoader referenced unknown path: /data/app/com.example.mook.bodyshop-1/lib/x86
05-20 20:55:56.918 2826-2826/com.example.mook.bodyshop I/InstantRun: Starting Instant Run Server for com.example.mook.bodyshop
05-20 20:56:00.049 2826-2826/com.example.mook.bodyshop W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-20 20:56:00.706 2826-2900/com.example.mook.bodyshop I/OpenGLRenderer: Initialized EGL, version 1.4
05-20 20:56:00.706 2826-2900/com.example.mook.bodyshop D/OpenGLRenderer: Swap behavior 1
05-20 20:56:00.789 2826-2900/com.example.mook.bodyshop E/EGL_emulation: tid 2900: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
05-20 20:56:00.789 2826-2900/com.example.mook.bodyshop W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xafdf71e0, error=EGL_BAD_MATCH
05-20 20:56:01.107 2826-2826/com.example.mook.bodyshop W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
05-20 20:57:24.514 2826-2900/com.example.mook.bodyshop E/EGL_emulation: tid 2900: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
05-20 20:57:24.514 2826-2900/com.example.mook.bodyshop W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xafdf71c0, error=EGL_BAD_MATCH
05-20 20:57:32.689 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 6.473ms
05-20 20:58:13.809 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 5.264ms
05-20 21:02:05.962 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 10.112ms
05-20 21:02:14.501 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 11.953ms
05-20 21:02:33.544 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 5.971ms
05-20 21:09:03.525 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 7.841ms
05-20 21:09:14.570 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 10.387ms
05-20 21:09:25.601 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 16.057ms
05-20 21:10:55.477 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 6.419ms
05-20 21:11:00.001 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 13.669ms
 05-20 21:11:08.070 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 9.188ms
 05-20 21:13:12.125 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 23.024ms
 05-20 21:13:58.779 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 9.147ms
 05-20 21:14:12.845 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 10.171ms
 05-20 21:14:18.850 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 5.055ms
 05-20 21:15:02.487 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 6.034ms
 05-20 21:15:54.662 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 14.200ms
 05-20 21:16:02.691 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 15.037ms
 05-20 21:16:24.743 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 5.166ms
 05-20 21:18:55.781 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 8.182ms
 05-20 21:18:56.781 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 7.999ms
 05-20 21:19:55.990 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 7.446ms
 05-20 21:20:41.639 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 9.632ms
 05-20 21:21:59.857 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 9.553ms
 05-20 21:22:54.563 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 5.610ms
 05-20 21:22:57.065 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 5.631ms
 05-20 21:24:22.929 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 33.581ms
 05-20 21:24:47.231 2826-2833/com.example.mook.bodyshop W/art: Suspending all threads took: 13.339ms

我只回答我自己的问题!问题是SplashScreen的扩展与主活动不同

public class SplashScreen extends Activity
public class MainActivity extends AppCompatActivity
所以我让它们都扩展
Activity
,因为当我扩展
AppCompatActivity
时,它仍然会在SplashScreen之后停止

public class SplashScreen extends Activity
public class MainActivity extends AppCompatActivity