I followed stackoverflow answer and medium tutorial to make Splash Screen of Android version, but when I start the app, it shows Splash Screen a moment and stop the application.
My Splash Screen logo image directoy
launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/splash_logo" />
</item>
</layer-list>
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
MainActivity.java
package com.example.privacyofanimal;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setStatusBarColor(0x00000000);
GeneratedPluginRegistrant.registerWith(this);
ViewTreeObserver vto = getFlutterView().getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
getFlutterView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
});
}
}
main.dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
SystemChrome.setEnabledSystemUIOverlays([]);
runApp(PrivacyOfAnimal());
}
class PrivacyOfAnimal extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '동물의 사생활',
home: Test(),
debugShowCheckedModeBanner: false,
);
}
}
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(),
);
}
}
My phone is Samsung Galaxy S8+ and I wanna fix this issue. What is the problem?
Error log
2019-01-23 16:44:03.443 18922-18922/com.handong.privacyofanimal E/AndroidRuntime: FATAL EXCEPTION: main Process: com.handong.privacyofanimal, PID: 18922 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.handong.privacyofanimal/com.handong.privacyofanimal.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.handong.privacyofanimal.MainActivity" on path: DexPathList[[zip file "/data/app/com.handong.privacyofanimal-rCGlJOS-fSwTgzOMfceE0g==/base.apk"],nativeLibraryDirectories=[/data/app/com.handong.privacyofanimal-rCGlJOS-fSwTgzOMfceE0g==/lib/arm64, /data/app/com.handong.privacyofanimal-rCGlJOS-fSwTgzOMfceE0g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2839) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.handong.privacyofanimal.MainActivity" on path: DexPathList[[zip file "/data/app/com.handong.privacyofanimal-rCGlJOS-fSwTgzOMfceE0g==/base.apk"],nativeLibraryDirectories=[/data/app/com.handong.privacyofanimal-rCGlJOS-fSwTgzOMfceE0g==/lib/arm64, /data/app/com.handong.privacyofanimal-rCGlJOS-fSwTgzOMfceE0g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.Instrumentation.newActivity(Instrumentation.java:1180) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2829)