flutter_background_geolocation icon indicating copy to clipboard operation
flutter_background_geolocation copied to clipboard

Permission Denial: broadcast from android asks to run as user -1 but is calling from user 0

Open omejiasq opened this issue 4 years ago • 22 comments

Your Environment

  • Plugin version:4.8.1
  • Platform: iOS or Android: Android 7.1.1
  • OS version:MAC 10.15
  • Device manufacturer / model:Samsung galaxy
  • Flutter info (flutter doctor):Flutter (Channel stable, 2.5.3, on Mac OS X 10.15 19A583 darwin-x64, locale es-419) Android toolchain - develop for Android devices (Android SDK version 33.0.0) Android Studio (version 2020.3)
  • Plugin config:
PASTE_YOUR_CODE_HERE

Dart:2.14.4

Expected Behavior

The app should open after closing it or restarting the samsung tablet.

Actual Behavior

After closing the app or restarting the smartphone, the app does not open on a samsung galaxy tablet running android 7.1.1, however on a samsung galaxy S21 it works fine when closed or restarted.

Steps to Reproduce

  1. git clone https://github.com/transistorsoft/flutter_background_geolocation.git
  2. cd flutter_background_geolocation/example
  3. flutter pub get
  4. flutter run
  5. The app runs fine on the samsung galaxy tablet, and I can use it fine and log tracking data on the platform, but then when I close it from the tablet it "doesn't slow it down", and then try to open it again from the desktop icon from the tablet, it breaks and the message appears if you want to restore the app.

Context

I am looking for how to solve the error that appears in the terminal after the application crashes, and I found in a post that I had to add these two lines to the AndroidManifest file and I did so but the error was not fixed:

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1201)] Check failed: fml::jni::CheckException(env). ' r0 00000000 r1 000020d9 r2 00000006 r3 00000008 r4 b6c3a58c r5 00000006 r6 b6c3a534 r7 0000010c r8 00000001 r9 bef4f950 sl 00000038 fp a3bd5ab0 ip 0000000b sp bef4f808 lr b3bb6fe7 pc b3bb9868 cpsr 200e0010 backtrace: #00 pc 0004a868 /system/lib/libc.so (tgkill+12) #01 pc 00047fe3 /system/lib/libc.so (pthread_kill+34) #02 pc 0001dbad /system/lib/libc.so (raise+10) #03 pc 00019321 /system/lib/libc.so (__libc_android_abort+34) #04 pc 00017388 /system/lib/libc.so (abort+4) #05 pc 000018dd /data/app/com.transistorsoft.flutterbackgroundgeolocationexample-1/lib/arm/libflutter.so (offset 0x11cb000) Lost connection to device. Exited (sigterm)

omejiasq avatar Nov 18 '22 19:11 omejiasq

Permission Denial: broadcast from android asks to run as user -1 but is calling from user 0

Why do your logs make no mention of the title of your issue?

christocracy avatar Nov 18 '22 20:11 christocracy

Oh, I see it.

christocracy avatar Nov 18 '22 20:11 christocracy

Flutter (Channel stable, 2.5.3)

I suggest you flutter upgrade. Latest is 3.3.0

christocracy avatar Nov 18 '22 20:11 christocracy

I run flutter upgrade and now i have 3.3.8 flutter version, and dart 2.18.4 but when i try run the app i get a lot of errors. I send you the logs:

Launching lib/main.dart on SM P550 in debug mode... ../../../../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.6/lib/src/structs.g.dart:661:31: Error: Member not found: 'UnicodeChar'. int get UnicodeChar => Char.UnicodeChar; ^^^^^^^^^^^ ../../../../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.6/lib/src/structs.g.dart:662:38: Error: Setter not found: 'UnicodeChar'. set UnicodeChar(int value) => Char.UnicodeChar = value; ^^^^^^^^^^^ ../../../../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.6/lib/src/structs.g.dart:664:29: Error: Member not found: 'AsciiChar'. int get AsciiChar => Char.AsciiChar; ^^^^^^^^^ ../../../../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.6/lib/src/structs.g.dart:665:36: Error: Setter not found: 'AsciiChar'. set AsciiChar(int value) => Char.AsciiChar = value; ^^^^^^^^^

FAILURE: Build failed with an exception.

  • Where: Script '/Users/user/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/user/development/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 32s Running Gradle task 'assembleDebug'... 33.8s Exception: Gradle task assembleDebug failed with exit code 1

What do i need to do know?

omejiasq avatar Nov 18 '22 21:11 omejiasq

You need to upgrade your app to support flutter v3.

Google your errors.

christocracy avatar Nov 18 '22 21:11 christocracy

Start by upgrading your other plugins.

christocracy avatar Nov 18 '22 21:11 christocracy

Sorry, what steps in which order do i need to do this? Maybe again follow this steps? $ git clone https://github.com/transistorsoft/flutter_background_geolocation.git $ cd flutter_background_geolocation/example $ flutter pub get $ flutter run

omejiasq avatar Nov 18 '22 21:11 omejiasq

I don't know what's wrong with your development environment but I just did the same and it worked:

Pixel 6 @ 13

$ git clone https://github.com/transistorsoft/flutter_background_geolocation.git
$ cd flutter_background_geolocation/example
$ flutter pub get
$ flutter run
$ flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.6 21G115 darwin-x64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

christocracy avatar Nov 18 '22 21:11 christocracy

googling your errors: https://github.com/flutter/flutter/issues/103674

christocracy avatar Nov 18 '22 21:11 christocracy

I fix the errors and when i run the app in debug mode and close from the device la app, and I open again the app, this works fine, but know when i stop the debugger in visual studio, and i try to open it directly open the desktop icon in my tablet, It shows a black screen for a few seconds and then a message appears that if you want to restart the application, I restart it and it reopens the black screen and so on. Then I restarted my tablet and the same thing happened again, black screen etc. But in the visual studio loss it did not show any errors.

I run flutter doctor:

(base) user@MacBook-Pro-de-user example % flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.3.8, on Mac OS X 10.15 19A583 darwin-x64, locale es-419) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [✗] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS development. Download at: https://developer.apple.com/xcode/download/ Or install Xcode via the App Store. Once installed, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.73.1) [✓] Connected device (2 available) [!] HTTP Host Availability ✗ HTTP host "https://pub.dev/" is not reachable. Reason: An error occurred while checking the HTTP host: Connection terminated during handshake

! Doctor found issues in 2 categories

omejiasq avatar Nov 18 '22 22:11 omejiasq

It works fine on my fleet of test devices:

  • Nexus 4 @ 4.4.4
  • Nexus 5 @ 6.0.1
  • Motorola Moto G @ 6.0.0
  • Google Pixel @ 10
  • Google Pixel 3a @ 12
  • Google Pixel 6 @ 13
  • Samsung Galaxy S20 FE @ 12.0.0
  • Samsung J @ 6.0.1
  • Samsung A510 @ 8.0.0
  • Huawei P20 Lite (ANE-LX3) @ 8.0.0
  • XIAOMI MI A2 Lite @ 10.0.0
  • Nokia TA-1027 @ 8.0.0
  • OnePlus A5010 @ 9.0.0

christocracy avatar Nov 18 '22 22:11 christocracy

I suggest you observe $ adb logcat for errors

christocracy avatar Nov 18 '22 22:11 christocracy

  1. How can I use the adb logcat command if the application works fine for me when I run it from visual studio and in this case it doesn't generate any errors, and it just doesn't work fine when I stop the visual studio debugger and then try to open it Is this app oppressing the desktop icon of my tablet?
  2. From the list of android devices I don't see that you have tried android 7. Have you tried with android 7 and with which iphone have you tried this app?

omejiasq avatar Nov 21 '22 01:11 omejiasq

If it works with Android 6 and 8, it works with 7.

christocracy avatar Nov 21 '22 01:11 christocracy

What version of iPhone and version of IoS did you try?

omejiasq avatar Nov 21 '22 01:11 omejiasq

with android 7 which brand of smartphone did you try?

omejiasq avatar Nov 21 '22 01:11 omejiasq

The plugin supports iOS 8.3 and up.

christocracy avatar Nov 21 '22 01:11 christocracy

Android 7 is not your problem.

christocracy avatar Nov 21 '22 01:11 christocracy

Ok, thank you very much for the answers, I will continue testing your plugin this week on more devices.

omejiasq avatar Nov 21 '22 01:11 omejiasq

I could to use and export the logcat logs. I attach this file only with the seconds when I open the application and the error appears when opening the app. It's very strange, because in rare cases it opens the app correctly when I open the desktop icon, but then I restart the tablet and then it generates the error again. Although I was looking at the logcat.txt file, I don't really understand why this error is coming up, can you please help me look at this file and tell me if you can see the error?

logcat4.txt

omejiasq avatar Nov 21 '22 04:11 omejiasq