Home > Mobile >  Flutter Creating apk but is not showing firebase data
Flutter Creating apk but is not showing firebase data

Time:03-02

I am creating an apk for android mobile to test there By using

flutter build apk --release

It build fine but is not showing firebase data like the fields I filled it's data etc.

Work fines with the flutter build apk --debug

apk release

with debug

android permission

CodePudding user response:

Are you initialize Firebase in your project main file?

  WidgetsFlutterBinding.ensureInitialized(),
  if (Platform.isAndroid)
    {
      await Firebase.initializeApp(), // firebase initialize 
    },
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
      .then(
    (_) {
      runApp(new MyApp());
    },
  )
};

CodePudding user response:

In main.dart add this code

 WidgetsFlutterBinding.ensureInitialized(),
  if (Platform.isAndroid)
    {
      await Firebase.initializeApp(), // firebase initialize 
    },
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
      .then(
    (_) {
      runApp(new MyApp());
    },
  )
};

Secondly In AndroidManifest.xml add

Path: [your App Name]/android/app/src/main/AndroidManifest.xml

It will resolve issue Hopefully.

Credits: 1.https://stackoverflow.com/users/15572654/wasiq-hussain

References:

  1. How to get .apk and .ipa file from flutter?
  2. How to add manifest permission to an application? to-an-application
  • Related