FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.1.0) classpath. You should manually set the same version via DependencyResolution
* 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 1m 47s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 109,7s
********************************************************************************
***********
The Gradle failure may have been because of AndroidX incompatibilities in this
Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
********************************************************************************
***********
Gradle task assembleDebug failed with exit code 1
@dvorapa on my side everything works fine. According to the build output you posted it looks like your App isn't configured to support AndroidX (which is a requirement for the permission_handler plugin since version 3.1.0).
You can find more information on the README.md page.
Yes, my app is configured, but it seems flutter_permission_handler is configured somehow wrong or incorrect, because other permission modules requiring AndroidX works just fine, only flutter_permission_handler does not. Could you fix the problem?
You can set which Androidx version will be used in gradle via #27254 issue thread. After that, if you still have error, you can give a try to upgrade kotlin & gradle versions.
I've got the same issue, even with version down to 3.0.2
EDIT : moving from Gradle 3.2.1 to 3.4.2 fix the issue for me
I'm using the latest flutter stable.And I have this similar problem.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.versionedparcelable:versionedparcelable' has different version for the compile (1.0.0-rc01) and runtime (1.1.0) classpath. You should manually set the same version via DependencyResolution
* 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
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 3.8s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin image_picker...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 0.7s
✓ Built build/app/outputs/repo.
Building plugin package_info...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 0.6s
✓ Built build/app/outputs/repo.
Building plugin permission_handler...
The plugin permission_handler could not be built due to the issue above.
Running Gradle task 'assembleAarRelease'...
@dvorapa, @BB-fat, please check if you are using gradle version 3.4.2 or higher (as suggested by @Nico04 and @m-cakir).
I've been using Gradle 3.4 when I encountered the error
@dvorapa that is strange, I am having a hard time reproducing this issue. Could you post the contents of the following files for me:
This would help me to better analyse the issue. Even more helpful would be if you could share a sample application reproducing the issue.
I've been using Gradle 3.4 together with Flutter 1.9.
This is the part of my code responsible for granting permissions:
super.initState();
Stream<Map<PermissionGroup, PermissionStatus>>.fromFuture(
PermissionHandler().requestPermissions(
[PermissionGroup.storage]))
.listen((Map<PermissionGroup, PermissionStatus> status) {
if (status[PermissionGroup.storage] != PermissionStatus.granted) {
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
} else {
Currently, I moved to Gradle 3.5 and Flutter 1.12 and I encountered a different issue. My app freezes in splashscreen / does not load itself when rights are granted. I moved to permissions_plugin package, which works like a charm for me since Flutter 1.9 / Gradle 3.2.
I suggest you to add your Gradle/Flutter minimal requirement into your pubspec.yaml. I'm not sure, if this is possible (should be though), anyway you should at least mention it in README.md.
@dvorapa given your latest feedback it seems the problem is related to the current version of Gradle and other dependencies you are using in your project.
We are currently using Gradle 3.5.1 and Gradle Wrapper 5.6.1, since this is out of sync with the current stable version of Flutter I will update the configuration to match Flutter 1.12.13+hotfix.5 which is Gradle 3.5.0 and Gradle Wrapper 5.6.2.
Not sure this will help you, the permissions_plugin project is still using 3.2.1 which seems not compatible with AndroidX (see here, where they suggest to update to at least 3.3.0 of the Gradle plugin).
Next release (version 4.1.0) will match the above mentioned versions. Hopefully this will help you fix your setup as well. Maybe there are other plugins that you are using which need to be updated, if this is the case please let me know and maybe I can help bump the issue for you?
As I mentioned, I solved the issue by using permissions_plugin package, which works just fine even on Android X devices thanks to compatibility layer in Flutter. Anyway, I would also suggest you to examine the issue of blocking app from rendering as this is clearly caused by permission_handler and seems to have nothing in common with Flutter/Gradle versions.
Most helpful comment
I'm using the latest flutter stable.And I have this similar problem.