Issue
Been working on this flutter project and everything's been going well. Now I'm done and want to deploy it to android but the app is not working on real android devices, I noticed the apps data usage is 0.00 so I tried adding all the permissions on android.xml, even added more security rules but all to no avail. Please has anyone ever encountered this and what was the solution?
Solution
So what happened was this
1st I didn't initialize FlutterBinding in my main.dart so I had to add it like this before Initialising my firebase
void main() async {
///Flutter binding initialized
WidgetsFlutterBinding.ensureInitialized();
///Firebase initialized
await Firebase.initializeApp();
runApp(MyApp());
}
2nd (just to make sure everything works well) I added Google Services dependencies in my project level build.gradle
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.13' // Google Services plugin
}
And then firebase plugin in my app level build.gradle
apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}
and that's all... My app worked
Answered By - Cisco
Answer Checked By - Pedro (JavaFixing Volunteer)