flutter-form-builder-ecosystem / flutter_form_builder

Simple form maker for Flutter Framework
https://pub.dev/packages/flutter_form_builder
MIT License
1.5k stars 542 forks source link

version: ^4.0.0-pre.4 ->FAILURE: Build failed with an exception. #508

Closed limsocheat closed 4 years ago

limsocheat commented 4 years ago

`FAILURE: Build failed with an exception.

BUILD FAILED in 19s 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 file_picker... Running Gradle task 'assembleAarRelease'...

C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:10: error: cannot find symbol import androidx.lifecycle.DefaultLifecycleObserver; ^ symbol: class DefaultLifecycleObserver location: package androidx.lifecycle C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:20: error: cannot find symbol import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter; ^ symbol: class FlutterLifecycleAdapter location: package io.flutter.embedding.engine.plugins.lifecycle C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:38: error: cannot find symbol implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver { ^ symbol: class DefaultLifecycleObserver location: class FilePickerPlugin C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:45: error: method does not override or implement a method from a supertype @Override ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:49: error: method does not override or implement a method from a supertype @Override ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:53: error: method does not override or implement a method from a supertype @Override ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:57: error: method does not override or implement a method from a supertype @Override ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:61: error: method does not override or implement a method from a supertype @Override ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:66: error: method does not override or implement a method from a supertype @Override ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:277: error: cannot find symbol this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding); ^ symbol: variable FlutterLifecycleAdapter location: class FilePickerPlugin C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:278: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver this.lifecycle.addObserver(this.observer); ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\file_picker-2.0.9+1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:286: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver this.lifecycle.removeObserver(this.observer); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 12 errors

FAILURE: Build failed with an exception.

BUILD FAILED in 1s

Exception: The plugin file_picker could not be built due to the issue above. `

danvick commented 4 years ago

Hi @limsocheat, Kindly check your Android API version and make sure your app is compatible with AndroidX as recommended by the Flutter team.

limsocheat commented 4 years ago

Thanks for your reply.

This is my gradle.properties

org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true android.enableR8=true

LefebvreIlyas commented 4 years ago

Hello @limsocheat, @danvick

  1. build.gradle Replace classpath 'com.android.tools.build:gradle:X.X.X' BY classpath 'com.android.tools.build:gradle:4.1.0' (See https://github.com/miguelpruivo/flutter_file_picker/issues/223#issuecomment-715721227)

  2. gradle\wrapper\gradle-wrapper.properties Replace distributionUrl=https\://services.gradle.org/distributions/gradle-X.X.X-all.zip BY distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip (Thanks to the error message)

  3. Enjoy 🎉

danielweil commented 4 years ago

You have to change compileSdkVersion and targetSdkVersion inside build.gradle to version 29 to fix this error.