Flutter - 在 Android 上访问隐藏方法 Lsun/misc/Unsafe 错误

Wil*_*iam 25 flutter

我收到一个 Flutter 项目的错误。我将开始一个一个地停用插件,并希望找出其中一个是否导致了问题。在那之前,如果有人有建议,我会留在这里。

Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)

Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed) E/GoogleMapController(29124): Cannot enable MyLocation layer as location permissions are not granted

dependencies:
  flutter:
    sdk: flutter
  firebase_auth: ^0.15.5+2
  cloud_firestore: ^0.13.5
  firebase_storage: ^3.1.3
  firebase_core: ^0.4.4+3
  provider: ^4.1.2
  google_sign_in: ^4.4.6
  google_maps_flutter: ^0.5.28
  latlong: ^0.6.1
  flappy_search_bar: ^1.7.2
  http: ^0.12.1
  image_cropper: ^1.2.1
  image_picker: ^0.6.3+4
  geolocator: ^5.3.1


Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-RO)

[?] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[?] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] Android Studio (version 3.5)
    ? Flutter plugin not installed; this adds Flutter specific functionality.
    ? Dart plugin not installed; this adds Dart specific functionality.
[?] VS Code (version 1.45.1)
[?] Connected device (1 available)

! Doctor found issues in 1 category.
Run Code Online (Sandbox Code Playgroud)

使用 Android Studio 打开 Android 应用程序显示以下通知:

Compilation is not supported for following modules: cloud_firestore, cloud_firestore_web, firebase_auth, 
firebase_core, firebase_auth_web, firebase_core_web, google_maps_flutter, flutter_plugin_android_lifecycle, 
google_sign_in, google_sign_in_web, 
location. 
Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
Run Code Online (Sandbox Code Playgroud)

Twi*_*aby 13

根据 Flutter 团队的回复,这是一个 Android protobuf 问题:https://github.com/flutter/flutter/issues/27095#issuecomment-722857855

它已在 Android 11 中修复:https://android-review.googlesource.com/c/platform/art/+/1294616/