2017-05-21 1 views
0

에뮬레이터를 실행하고 스플래시 화면 후에 앱을 실행할 때마다 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> 

이는 매니페스트입니다. 다음은 여기에 다음

import java.util.Timer; 
import java.util.TimerTask; 

public class SplashScreen extends Activity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_splash_screen); 
/*Thread myThread = new Thread(){ 
    @Override 
    public void run() { 
     try { 
      sleep(1000); 
      Intent intent = new Intent(SplashScreen.this, MainActivity.class); 
      startActivity(intent); 
      finish(); 
     } catch (InterruptedException e) { 
      e.printStackTrace(); 
     } 
    } 

}; 
    myThread.start();*/ 
    TimerTask task = new TimerTask() { 
     @Override 
     public void run() { 

      startActivity(new Intent(SplashScreen.this, MainActivity.class)); 
      finish(); 
     } 
    }; 
    Timer opening = new Timer(); 
    opening.schedule(task, 5000); 
} 
} 

SplashScreen.java

것은 내 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); 
} 
} 

그리고 마지막으로 로그 캣입니다.

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 

답변

0

나는 내 자신의 질문에 대답합니다. 문제는 SplashScreen이 MainActivity와 다른 확장입니다.

public class SplashScreen extends Activity 
public class MainActivity extends AppCompatActivity 

그래서 내가 AppCompatActivity를 확장 할 때 여전히되는 SplashScreen 후 중지 때문에 둘은 Activity을 확장했다.

관련 문제