Android Flutter app crashed during stratup

0

I used this fit_kit(https://pub.dev/packages/fit_kit#-readme-tab-) for Flutter to fetch health data from iOS and Android, the iOS part seems to work just fine, whereas the Android app always crashed during startup. I have registered the application on Google Console and also Firebase.

This the verbose for the flutter run -verbose

                   nin.RevocationBoundService" (Raw:
                   "com.google.android.gms.auth.api.signin.RevocationBoundServic
                   e")
                   A:
                   android:permission(0x01010006)="com.google.android.gms.auth.a
                   pi.signin.permission.REVOCATION_NOTIFICATION" (Raw:
                   "com.google.android.gms.auth.api.signin.permission.REVOCATION
                   _NOTIFICATION")
                   A: android:exported(0x01010010)=(type 0x12)0xffffffff
                 E: service (line=69)
                   A:
                   android:name(0x01010003)="com.google.firebase.components.Comp
                   onentDiscoveryService" (Raw:
                   "com.google.firebase.components.ComponentDiscoveryService")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                   E: meta-data (line=72)
                     A:
                     android:name(0x01010003)="com.google.firebase.components:co
                     m.google.firebase.analytics.connector.internal.AnalyticsCon
                     nectorRegistrar" (Raw:
                     "com.google.firebase.components:com.google.firebase.analyti
                     cs.connector.internal.AnalyticsConnectorRegistrar")
                     A:
                     android:value(0x01010024)="com.google.firebase.components.C
                     omponentRegistrar" (Raw:
                     "com.google.firebase.components.ComponentRegistrar")
                   E: meta-data (line=75)
                     A:
                     android:name(0x01010003)="com.google.firebase.components:co
                     m.google.firebase.iid.Registrar" (Raw:
                     "com.google.firebase.components:com.google.firebase.iid.Reg
                     istrar")
                     A:
                     android:value(0x01010024)="com.google.firebase.components.C
                     omponentRegistrar" (Raw:
                     "com.google.firebase.components.ComponentRegistrar")
                 E: receiver (line=80)
                   A:
                   android:name(0x01010003)="com.google.firebase.iid.FirebaseIns
                   tanceIdReceiver" (Raw:
                   "com.google.firebase.iid.FirebaseInstanceIdReceiver")
                   A:
                   android:permission(0x01010006)="com.google.android.c2dm.permi
                   ssion.SEND" (Raw: "com.google.android.c2dm.permission.SEND")
                   A: android:exported(0x01010010)=(type 0x12)0xffffffff
                   E: intent-filter (line=84)
                     E: action (line=85)
                       A:
                       android:name(0x01010003)="com.google.android.c2dm.intent.
                       RECEIVE" (Raw: "com.google.android.c2dm.intent.RECEIVE")
                 E: activity (line=89)
                   A: android:theme(0x01010000)=@0x1030010
                   A:
                   android:name(0x01010003)="com.google.android.gms.common.api.G
                   oogleApiActivity" (Raw:
                   "com.google.android.gms.common.api.GoogleApiActivity")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: receiver (line=94)
                   A:
                   android:name(0x01010003)="com.google.android.gms.measurement.
                   AppMeasurementReceiver" (Raw:
                   "com.google.android.gms.measurement.AppMeasurementReceiver")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: receiver (line=99)
                   A:
                   android:name(0x01010003)="com.google.android.gms.measurement.
                   AppMeasurementInstallReferrerReceiver" (Raw:
                   "com.google.android.gms.measurement.AppMeasurementInstallRefe
                   rrerReceiver")
                   A:
                   android:permission(0x01010006)="android.permission.INSTALL_PA
                   CKAGES" (Raw: "android.permission.INSTALL_PACKAGES")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0xffffffff
                   E: intent-filter (line=104)
                     E: action (line=105)
                       A:
                       android:name(0x01010003)="com.android.vending.INSTALL_REF
                       ERRER" (Raw: "com.android.vending.INSTALL_REFERRER")
                 E: service (line=109)
                   A:
                   android:name(0x01010003)="com.google.android.gms.measurement.
                   AppMeasurementService" (Raw:
                   "com.google.android.gms.measurement.AppMeasurementService")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: service (line=113)
                   A:
                   android:name(0x01010003)="com.google.android.gms.measurement.
                   AppMeasurementJobService" (Raw:
                   "com.google.android.gms.measurement.AppMeasurementJobService"
                   )
                   A:
                   android:permission(0x01010006)="android.permission.BIND_JOB_S
                   ERVICE" (Raw: "android.permission.BIND_JOB_SERVICE")
                   A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
                   A: android:exported(0x01010010)=(type 0x12)0x0
                 E: provider (line=119)
                   A:
                   android:name(0x01010003)="com.google.firebase.provider.Fireba
                   seInitProvider" (Raw:
                   "com.google.firebase.provider.FirebaseInitProvider")
                   A: android:exported(0x01010010)=(type 0x12)0x0
                   A:
                   android:authorities(0x01010018)="com.techstar.sunwaybooster.f
                   irebaseinitprovider" (Raw:
                   "com.techstar.sunwaybooster.firebaseinitprovider")
                   A: android:initOrder(0x0101001a)=(type 0x10)0x64
                 E: meta-data (line=125)
                   A: android:name(0x01010003)="com.google.android.gms.version"
                   (Raw: "com.google.android.gms.version")
                   A: android:value(0x01010024)=@0x7f060000
[  +14 ms] Stopping app 'app.apk' on SM G935F.
[   +1 ms] executing: /Users/rafidkarim/Library/Android/sdk/platform-tools/adb
-s 9885e6494544364944 shell am force-stop com.techstar.sunwaybooster
[ +127 ms] executing: /Users/rafidkarim/Library/Android/sdk/platform-tools/adb
-s 9885e6494544364944 shell pm list packages com.techstar.sunwaybooster
[ +943 ms] package:com.techstar.sunwaybooster
[   +4 ms] executing: /Users/rafidkarim/Library/Android/sdk/platform-tools/adb
-s 9885e6494544364944 shell cat
/data/local/tmp/sky.com.techstar.sunwaybooster.sha1
[  +45 ms] 4423ab3ded33f0b36290722420e2cef86fb2fc07
[        ] Latest build already installed.
[        ] SM G935F startApp
[   +1 ms] executing: /Users/rafidkarim/Library/Android/sdk/platform-tools/adb
-s 9885e6494544364944 shell am start -a android.intent.action.RUN -f 0x20000000
--ez enable-background-compilation true --ez enable-dart-profiling true --ez
enable-checked-mode true --ez verify-entry-points true
com.techstar.sunwaybooster/com.techstar.sunwaybooster.MainActivity
[ +149 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000
cmp=com.techstar.sunwaybooster/.MainActivity (has extras) }
[        ] Waiting for observatory port to be available...

hereis for the flutter doctor


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.38.0)
[✓] Connected device (5 available)

and the AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.app">

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Sunway Booster"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

I need to fetch the health data from the fit_kit, for the iOS it works fine, but in the Android side the app always crashed during startup. I couldn't put full of the --verbose

android
flutter
asked on Stack Overflow Sep 8, 2019 by R.Karim • edited Sep 9, 2019 by Mehul Kabaria

1 Answer

0

Did you add the App folder google-services file in Android Studio? If you haven't added it, your iOS app will automatically close when your application opens.

If you don't know how can find these file. Please follow these steps;

  1. Go firebase console
  2. Please click to settings button from the left of the screen
  3. Project settings
  4. Your Apps - Click your iOS App
  5. Download google-services.json
answered on Stack Overflow Sep 8, 2019 by secret

User contributions licensed under CC BY-SA 3.0