1
votes

I am very confused about why the flutter debug banner is on the released app. I am seeing a small issue. After flutter build apk --flavor prod building when I installed the apk on my phone it still has the debug banner on. Any idea why?

// app.dart
class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    AppThemes.context = context;
    return MultiProvider(
      providers: providers,
      child: Consumer<FirebaseAnalytics>(builder: (context, analytics, child) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          title: Provider.of<AppConfig>(context).appTitle,
          theme: AppThemes.defaultTheme,
          localizationsDelegates: [
            S.delegate,
            GlobalMaterialLocalizations.delegate,
          ],
          supportedLocales: S.delegate.supportedLocales,
          navigatorObservers: [
            FirebaseAnalyticsObserver(
              analytics: analytics,
              nameExtractor: analyticsNameExtractor,
            )
          ],
          navigatorKey: NavigationService.navigatorKey,
          onGenerateRoute: AppRoutes.onGenerateRoute,
          home: AuthHomePage(),
        );
      }),
    );
  }
}

I am also seeing another crazy issue when I am running the prod instance flutter run --flavor prod it works with all the screen, but with released apk one of the screen showing gray, if I had to guess not able to fetch data from firebase I guess, any way to debug that?

I am using https://github.com/lohanidamodar/flutter_firebase_starter

EDIT android/app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {

    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        multiDexEnabled true

        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.android"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    flavorDimensions "app"
    productFlavors {
        dev {
            dimension "app"
            applicationIdSuffix ".dev"
        }
        prod {
            dimension "app"
        }
    }

  signingConfigs {
      release {
          keyAlias keystoreProperties['keyAlias']
          keyPassword keystoreProperties['keyPassword']
          storeFile file(keystoreProperties['storeFile'])
          storePassword keystoreProperties['storePassword']
      }
  }
  buildTypes {

        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
1
Could you show your Gradle file? (hide any sensible data)Mariano Zorrilla
Check if internet permissions are specified in the prod version. referencedev-aentgs
@MarianoZorrilla Sorry, which Gradle file? Did you mean build.gradle on top-level or app level?Subhendu Kundu
@reference I am able to login with my google account, it's able to get data from the other collections. Just weird :(Subhendu Kundu
I did that too. :)Subhendu Kundu

1 Answers

0
votes

Figured it out, The banner was the issue as I wasn't passing the file name it supposed to use. My prod main file was named main_prod.dart. So to fix it I had to run flutter build apk --flavor prod -t lib/main_prod.dart. For reference try this.

The blank issue was due to a warning Incorrect use of ParentDataWidget.. Turned out I was using an Expanded widget outside of Column. This helped me.