I've tried using this in my app but can not compile. I tried by using "geolocator: ^5.3.1" in pubspec.yaml but since I got these errors I downloaded the source along with the source for the package "location_permissions" which compiled no problem when I opened the app directly and ran the examples. But when I add it into my Android app I get this.
Some kind of issue with using location_permissions package.
F:_WORK_FLUTTERflutter-permission-plugins-developpackageslocation_permissionsandroidsrcmainjavacombaseflowlocation_permissionsLocationPermissionsPlugin.java:284: error: cannot find symbol
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && permission.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION));
^
symbol: variable Q
location: class VERSION_CODES
F:_WORK_FLUTTERflutter-permission-plugins-developpackageslocation_permissionsandroidsrcmainjavacombaseflowlocation_permissionsLocationPermissionsPlugin.java:284: error: cannot find symbol
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && permission.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION));
^
symbol: variable ACCESS_BACKGROUND_LOCATION
location: class permission
F:_WORK_FLUTTERflutter-permission-plugins-developpackageslocation_permissionsandroidsrcmainjavacombaseflowlocation_permissionsLocationPermissionsPlugin.java:310: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.ACCESS_BACKGROUND_LOCATION, context)) {
^
symbol: variable Q
location: class VERSION_CODES
Changed my build.gradle
android {
compileSdkVersion 29
and I am using AndroidX
but same error.
i've put the following code inside root build.gradle:
ext {
compileSdkVersion = 29
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
}
}
}
}
And in app build.gradle:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
}
It worked for me!
ext {
compileSdkVersion = 29
}subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
}
}
}
}
Worked for me too! Thanks!
Closing this issue, since @MigoTiti seems to have provided a solution and no other feedback was received. @MigoTiti thanks for your contribution also thanks to @MarcioAlexandroni for confirming it works.
Most helpful comment
i've put the following code inside root build.gradle:
And in app build.gradle:
It worked for me!