JhonMt
JhonMt

Reputation: 11

Flutter Firebase app runs fine in simulator but crashes when tested in testflight

Recently I've joined a project of a flutter app using firebase, and everything was fine until it comes to make the production builds. For Android it works fine. But for ios I'm facing a problem that in the simulator it runs without a problem but when I uploaded it to Testflight for my coworkers to test it immediately crashes when opened.

That's my flutter doctor -v:

[✓] Flutter (Channel unknown, 2.2.2, on macOS 11.2.3 20D91 darwin-x64, locale
    pt-BR)
    • Flutter version 2.2.2 at /Users/leonardofelix/flutter
    • Framework revision d79295af24 (4 months ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/leonardofelix/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.61.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.27.0

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • 94BE45CC-ED04-4892-B3A6-3F43D0A147AD • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)               • chrome                               •
      web-javascript • Google Chrome 94.0.4606.81

And the crash report that a tester of testflight sent to me:

crashlog.crash

I've already tested some things that I found googling, like add the Google-Services.plist again using xcode and verified if the schemas to the archive were pointing to release mode. But none of them worked.

If any additional data is needed, I'll be glad to provide. So thanks in advance for any help.

Upvotes: 0

Views: 703

Answers (1)

JhonMt
JhonMt

Reputation: 11

Well, I found the error. I had changed the Flutter version using git (thus, the Flutter folder is a git repository). When I changed the version, it left the cache from the other Flutter version, and that cache was causing the problem.

One thing that helped me to find this out was running the release build in a physical device using Xcode; there it prompt me the following error:

Error while initializing the Dart VM: Wrong full snapshot version, expected '9cf77f4405212c45daf608e1cd646852' found 'e4a09dbf2bb120fe4674e0576617a0dc'

And for that, I found a solution on the web. What I did was to remove the folder cache inside <yourFlutterDir>/bin and run the following commands in the Flutter directory:

git reset --hard
git clean -xffd
flutter doctor

And then, I went to my Flutter project folder, ran flutter clean, and finally flutter build ios.

So the project built successfully, and the app worked in iOS.

Upvotes: 1

Related Questions