Closed happyphper closed 4 years ago
what's the code of your MainActivity.java ?
@diegoveloper The MainActivity.java is not auto created. So I copy your code the android/app/src/main/java/com/example/rrcp_flutter/MainActivity.java
. code is same. like this
package com.example.rrcp_flutter;
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);
//make transparent status bar
getWindow().setStatusBarColor(0x00000000);
GeneratedPluginRegistrant.registerWith(this);
//Remove full screen flag after load
ViewTreeObserver vto = getFlutterView().getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
getFlutterView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
});
}
}
Actually, you don't need to modify the MainActivity , remove that class, just use the classes generated using flutter create .
Thanks a lot.
I create a new project, and use the flutter_native_splash to create android native splash.
I found there are something differences between new project and old project. then compare with these, I solved this problem.
and for IOS, I used xcode to adjust the size.
Flutter : Splash Screen
In Android,from step 1 to 4,I did these, but have a problem is that:
I clone you project to local and All is right.
So I compare android your directory to my directory,
I find a
android/app/src/main/AndroidManifest.xml
andandroid/app/build.gradle
are different, the difference is thatput this code to your project, and the error occurred.
I can't solve this problem, Could you have any solution?
My Flutter version.