Lyokone / flutterlocation

A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.
MIT License
1.11k stars 820 forks source link

App crash on exit : Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull #488

Closed 2math closed 3 years ago

2math commented 3 years ago

Describe the bug Whit every 3.+ version that I use, there is a crash on android app exit. It looks like it expects some parameter to be non-nullable but it is. Whit version 2.5.4 there is no problem

Tested on:

Other plugins:

Additional logs

2021-01-17 13:00:59.094 1414-1414/com.vertiv.field_service.dev D/AndroidRuntime: Shutting down VM
2021-01-17 13:00:59.098 1414-1414/com.vertiv.field_service.dev E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.vertiv.field_service.dev, PID: 1414
    java.lang.RuntimeException: Unable to destroy activity {com.vertiv.field_service.dev/com.vertiv.vertiv_tasks.MainActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter activity
        at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5105)
        at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5135)
        at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7660)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter activity
        at com.lyokone.location.FlutterLocationService.setActivity(Unknown Source:2)
        at com.lyokone.location.LocationPlugin.deinitialize(LocationPlugin.java:121)
        at com.lyokone.location.LocationPlugin.detachActivity(LocationPlugin.java:56)
        at com.lyokone.location.LocationPlugin.onDetachedFromActivity(LocationPlugin.java:69)
        at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.detachFromActivity(FlutterEngineConnectionRegistry.java:389)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:556)
        at io.flutter.embedding.android.FlutterActivity.release(FlutterActivity.java:587)
        at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java:608)
        at android.app.Activity.performDestroy(Activity.java:8245)
        at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1344)
        at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5090)
        at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5135) 
        at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7660) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

Flutter doctor [√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.19041.746], locale bg-BG) • Flutter version 1.26.0-1.0.pre at C:\code\soft\flutter_sdk\flutter • Framework revision 63062a6443 (5 weeks ago), 2020-12-13 23:19:13 +0800 • Engine revision 4797b06652 • Dart version 2.12.0 (build 2.12.0-141.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at C:\Users\x\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.2 • Java binary at: C:\code\soft\studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0) • Android Studio at C:\code\soft\studio • 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-b01)

[√] Connected device (3 available) • Pixel 3a XL (mobile) • 94DAX0DRW1 • android-arm64 • Android 11 (API 30) • Chrome (web) • chrome • web-javascript • Google Chrome 87.0.4280.141 • Edge (web) • edge • web-javascript • Microsoft Edge 87.0.664.75

Thanks in advance!

2math commented 3 years ago

I think the problem is also kotlin related, because I have another project where on create kotlin option was unchecked and it works with v3.0.2 great

xmany commented 3 years ago

Same, crash on exit

Stewioie commented 3 years ago

Same here

Stewioie commented 3 years ago

FlutterLocationService.java ln 144

Change fun setActivity(activity: Activity) to fun setActivity(activity: Activity?)

RashidaBegamShaik commented 3 years ago

@Lyokone I am facing the same issue...

espadon8004 commented 3 years ago

Same issue on my side :/

absdot commented 3 years ago

Same issue too

percula commented 3 years ago

@Stewioie that change is already in the repo so I believe it's just a matter of time before this issue is fixed 🙂.

danielgomezrico commented 3 years ago

This issue is duplicated from https://github.com/Lyokone/flutterlocation/issues/466

stale[bot] commented 3 years ago

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.

Lyokone commented 3 years ago

Hi, should be fixed in 4.2.0 :)