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
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: