我有一个flutter android应用程序请求位置许可。
情况1)未给予位置权限,应用程序正常打开并要求位置权限,一切工作正常
情况2)给出大致位置许可,应用程序正常打开,一切工作正常
案例3)(问题)宝贵的位置权限被给予,但应用程序不打开,它显示白屏(android闪屏)10-20秒,然后崩溃,没有适当的错误信息
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.appName">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
清单文件
Geolocator Flutter lib
geolocator: ^9.0.2
日志消息
F/crash_dump64(15410): crash_dump.cpp:487] failed to attach to thread 669: Permission denied
F/crash_dump64(15539): crash_dump.cpp:487] failed to attach to thread 744: Permission denied
Logcat消息
2023-03-30 21:28:38.174 29257-29283/com.example.app_namek I/Quality: stackInfo :----- pid 29257 at 2023-03-30 21:28:38.150 -----;Cmd line: com.example.app_namek;"main" prio=5 tid=2 TIMED_WAITING sysTid=29257; at jdk.internal.misc.Unsafe.park(Native Method); at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234); at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1079); at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1369); at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278); at com.google.android.gms.internal.location.zzau.getLastLocation(com.google.android.gms:play-services-location@@21.0.1:12); at com.wongpiwat.trust_location.LocationAssistant.checkInitialLocation(LocationAssistant.java:494); at com.wongpiwat.trust_location.LocationAssistant.access$600(LocationAssistant.java:57); at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:730); at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:722); at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(com.google.android.gms:play-services-base@@18.1.0:6); at android.os.Handler.dispatchMessage(Handler.java:106); at android.os.Looper.loopOnce(Looper.java:233); at android.os.Looper.loop(Looper.java:344); at android.app.ActivityThread.main(ActivityThread.java:8212); at java.lang.reflect.Method.invoke(Native Method); at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584); at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034);
2023-03-30 21:28:39.684 29257-29283/com.example.app_namek I/Quality: stackInfo :----- pid 29257 at 2023-03-30 21:28:39.679 -----;Cmd line: com.example.app_namek;"main" prio=5 tid=2 TIMED_WAITING sysTid=29257; at jdk.internal.misc.Unsafe.park(Native Method); at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234); at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1079); at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1369); at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278); at com.google.android.gms.internal.location.zzau.getLastLocation(com.google.android.gms:play-services-location@@21.0.1:12); at com.wongpiwat.trust_location.LocationAssistant.checkInitialLocation(LocationAssistant.java:494); at com.wongpiwat.trust_location.LocationAssistant.access$600(LocationAssistant.java:57); at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:730); at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:722); at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(com.google.android.gms:play-services-base@@18.1.0:6); at android.os.Handler.dispatchMessage(Handler.java:106); at android.os.Looper.loopOnce(Looper.java:233); at android.os.Looper.loop(Looper.java:344); at android.app.ActivityThread.main(ActivityThread.java:8212); at java.lang.reflect.Method.invoke(Native Method); at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584); at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034);
2023-03-30 21:28:48.004 29257-29269/com.example.app_namek I/app_name: Thread[6,tid=29269,WaitingInMainSignalCatcherLoop,Thread*=0xb4000071db901000,peer=0x136c0f38,"Signal Catcher"]: reacting to signal 3
2023-03-30 21:28:48.004 29257-29269/com.example.app_namek I/app_name:
2023-03-30 21:28:48.152 29257-29269/com.example.app_namek I/app_name: Wrote stack traces to tombstoned
正如@Swanand在评论中提到的。
可以使用
dependency_overrides: geolocator_android: 4.1.4
将这个额外的位添加到pubspec.yaml