I am working with geolocator and permission_handler package in my app but now both packages have different requirement for compileSdkVersion
which is 30
and 31
respectively. I am trying to change compileSdkVersion but its not working anymore
Now if I switch to 30 it gives following error
Launching lib\main.dart on INE LX1r in debug mode...
Parameter format not correct -
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\contacts_service-0.4.6\android\src\main\java\flutter\plugins\contactsservice\contactsservice\ContactsServicePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:321: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
^
symbol: variable S
location: class VERSION_CODES
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:72: error: cannot find symbol
case Manifest.permission.BLUETOOTH_SCAN:
^
symbol: variable BLUETOOTH_SCAN
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:74: error: cannot find symbol
case Manifest.permission.BLUETOOTH_ADVERTISE:
^
symbol: variable BLUETOOTH_ADVERTISE
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:76: error: cannot find symbol
case Manifest.permission.BLUETOOTH_CONNECT:
^
symbol: variable BLUETOOTH_CONNECT
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:259: error: cannot find symbol
String result = determineBluetoothPermission(context, Manifest.permission.BLUETOOTH_SCAN);
^
symbol: variable BLUETOOTH_SCAN
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:270: error: cannot find symbol
String result = determineBluetoothPermission(context, Manifest.permission.BLUETOOTH_ADVERTISE);
^
symbol: variable BLUETOOTH_ADVERTISE
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:281: error: cannot find symbol
String result = determineBluetoothPermission(context, Manifest.permission.BLUETOOTH_CONNECT);
^
symbol: variable BLUETOOTH_CONNECT
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:370: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && hasPermissionInManifest(context, null, permission )) {
^
symbol: variable S
location: class VERSION_CODES
8 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':permission_handler: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 22s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
and when I switch to 31 it gives following error
Launching lib\main.dart on INE LX1r in debug mode...
Parameter format not correct -
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\contacts_service-0.4.6\android\src\main\java\flutter\plugins\contactsservice\contactsservice\ContactsServicePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\geolocator_android-1.0.0\android\src\main\java\com\baseflow\geolocator\location\LocationManagerClient.java:10: warning: [deprecation] LocationProvider in android.location has been deprecated
import android.location.LocationProvider;
^
error: warnings found and -Werror specified
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\geolocator_android-1.0.0\android\src\main\java\com\baseflow\geolocator\location\LocationMapper.java:29: warning: [deprecation] isFromMockProvider() in Location has been deprecated
position.put("is_mocked", location.isFromMockProvider());
^
1 error
2 warnings
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':geolocator_android: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 18s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
What do I do now?
compileSdkVersion 31
. I changed from 30 to 31 to fix that in my case – Leopard