Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - Accessing hidden method Lsun/misc/Unsafe error on Android

Tags:

flutter

I'm getting an error for a Flutter project. I will start deactivating plugins one by one and hopefully find if one of them is causing the problem. Until then I'll leave this here in case anybody has suggestions.

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.

Opening the Android app with Android Studio showed the following notice:

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.
like image 505
William Avatar asked May 20 '20 11:05

William


2 Answers

According to Flutter team's response, it's an Android protobuf issue: https://github.com/flutter/flutter/issues/27095#issuecomment-722857855.

It's been fixed in Android 11: https://android-review.googlesource.com/c/platform/art/+/1294616/.

like image 133
Twisted Lullaby Avatar answered Nov 13 '22 21:11

Twisted Lullaby


You can fix this by turning off the backup. Add this tag on your file "android > app > src > debug > AndroidManifest.xml":

<application android:allowBackup="false">

Run

flutter clean
flutter run
flutter create .

Here is some information about your problem https://developer.android.com/guide/topics/data/autobackup .

like image 1
Zaenury Adhiim Avatar answered Nov 13 '22 23:11

Zaenury Adhiim