There is an error when I run the code including simple_permissions on flutter project.
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:10: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:156: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, 0);
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:163: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class SimplePermissionsPlugin
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:171: error: cannot find symbol
if (ActivityCompat.shouldShowRequestPermissionRationale(registrar.activity(), permission)) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
C:\Users\ria\Downloads\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:175: error: cannot find symbol
if (ActivityCompat.checkSelfPermission(registrar.context(), permission) == PackageManager.PERMISSION_GRANTED) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':simple_permissions:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
*******************************************************************************************
I was getting the same issue, after some searches I found this repository.
https://github.com/tq-systems/simple_permissions
This repository solved the AndroidX compatibility issues. import it into the pubspec.yaml like that:
dependencies:
simple_permissions:
git:
url: https://github.com/tq-systems/simple_permissions.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With