flutterlocation icon indicating copy to clipboard operation
flutterlocation copied to clipboard

App crashes Unable to create service com.lyokone.location.FlutterLocationService

Open heikotroetsch opened this issue 2 years ago • 3 comments

Describe the bug When launching the flutter app the app compiles and launches on the device. After a short launch with a white screen, the error occurs and the app crashes.

Expected behavior The app should not crash. Building the App on a Windows 10 device and launching it from there on a simulated and real pixel 3a with API version 30 using the same code base works fine.

Tested on:

  • Android, API Level 30, simulator real device both Pixel 3a
  • Build on Mac OS with Android studio

Other plugins: cupertino_icons: ^1.0.2 firebase_core: ^1.10.6 firebase_auth: ^3.3.4 firebase_storage: ^10.2.5 cloud_firestore: ^3.1.5 provider: ^6.0.1 google_fonts: ^2.1.0 permission_handler: ^8.3.0 geocoding: ^2.0.1 location: ^4.3.0 google_maps_flutter: ^2.1.1 http: ^0.13.4 uuid: ^3.0.5 flutter_google_places: ^0.3.0 image_picker: ^0.8.4+4 cached_network_image: ^3.2.0 get_it: ^7.2.0 flutter_rating_bar: ^4.0.0 get_it_mixin: ^3.1.3 cloud_functions: ^3.2.5 carousel_slider: ^4.0.0 intl: ^0.17.0 latlong2: ^0.8.1 flutterfire_ui: ^0.3.6+1 introduction_screen: ^3.0.0

Solutions tried:

  • Pulled fresh project state from git
  • Reinstalled flutter clean
  • Flutter clean
  • Android studio invoke cache
  • New Simulator created, tried different pixel versions
  • Upgraded Gradle and Kotlin
  • pub upgrade

Additional logs

Launching lib/main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
E/AndroidRuntime(11158): FATAL EXCEPTION: main
E/AndroidRuntime(11158): Process: com.example.yab, PID: 11158
E/AndroidRuntime(11158): java.lang.RuntimeException: Unable to create service com.lyokone.location.FlutterLocationService: java.lang.InstantiationException: java.lang.Class<com.lyokone.location.FlutterLocationService> cannot be instantiated
E/AndroidRuntime(11158): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4204)
E/AndroidRuntime(11158): 	at android.app.ActivityThread.access$1500(ActivityThread.java:237)
E/AndroidRuntime(11158): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
E/AndroidRuntime(11158): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(11158): 	at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(11158): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(11158): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(11158): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(11158): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime(11158): Caused by: java.lang.InstantiationException: java.lang.Class<com.lyokone.location.FlutterLocationService> cannot be instantiated
E/AndroidRuntime(11158): 	at java.lang.Class.newInstance(Native Method)
E/AndroidRuntime(11158): 	at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:129)
E/AndroidRuntime(11158): 	at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:75)
E/AndroidRuntime(11158): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4183)
E/AndroidRuntime(11158): 	... 8 more
Application finished.
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2.1 21D62 darwin-x64, locale en-GB)
    • Flutter version 2.10.3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 2021.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 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.63.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • macOS (desktop)         • macos         • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 99.0.4844.83

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

heikotroetsch avatar Mar 23 '22 13:03 heikotroetsch

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 28 '22 03:04 stale[bot]

I am also having the same issue.

ndesamuelmbah avatar Jul 08 '22 18:07 ndesamuelmbah

I also have this issue.

bulgarian-beast avatar Jul 25 '22 15:07 bulgarian-beast