My project is migrated to AndroidX and worked earlier with Flutter version 1.12.13+hotfix.7 and FilePicker version 1.4.3+2
Flutter Doctor output:
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.657], locale en-US)
• Flutter version 1.12.13+hotfix.9 at C:\flutter
• Framework revision f139b11009 (4 days ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\BLiyanage\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:\Users\BLiyanage\AppData\Local\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 43.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] IntelliJ IDEA Community Edition (version 2019.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3
• Flutter plugin version 44.0.3
• Dart plugin version 193.6494.35
[√] VS Code, 32-bit edition
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension version 3.4.1
[√] VS Code, 64-bit edition (version 1.42.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.4.1
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
Error log:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 2 executed, 15 up-to-date
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:12: error: cannot find
symbol
import androidx.lifecycle.DefaultLifecycleObserver;
^
symbol: class DefaultLifecycleObserver
location: package androidx.lifecycle
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:19: error: cannot find
symbol
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;
^
symbol: class FlutterLifecycleAdapter
location: package io.flutter.embedding.engine.plugins.lifecycle
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:35: error: cannot find
symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:42: error: method does
not override or implement a method from a supertype
@Override
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:46: error: method does
not override or implement a method from a supertype
@Override
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:50: error: method does
not override or implement a method from a supertype
@Override
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:54: error: method does
not override or implement a method from a supertype
@Override
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:58: error: method does
not override or implement a method from a supertype
@Override
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:63: error: method does
not override or implement a method from a supertype
@Override
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:253: error: cannot fin
d symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:254: error: incompatib
le types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:262: error: incompatib
le types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: C:\Users\BLiyanage\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerDelegate.java uses or overri
des a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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 1m 51s
The plugin file_picker could not be built due to the issue above.
@Blasanka this might sound dumb, but have you tried to flutter clean and then flutter build again after upgrading?
I highly doubt that a hotfix could introduce breaking changes at plugin's implementation, but...
Yes, even tried pub cache repair, cleaning building android directory with AS also did not work.
@Blasanka this looks like project related, otherwise I would say it would not work for _everyone_ as it's complaining to dependencies not found. I'm still at hotfix.8, could you downgrade to hotfix.8 and let me know if it works for you?
Could it be that hotfix.9 introduced breaking changes?
Same issue with the eariler version ^1.4.3+2.
@Blasanka no, I'm suggesting 1.5.1 and Flutter stable version 1.12.13+hotfix.8
Im on it. Can I know your Dart SDK version? My project version is sdk: ">=2.6.0 <3.0.0"
This is where I'm currently at:
✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.4 19E266,
locale pt-PT)
• Flutter version 1.12.13+hotfix.8 at /Users/miguelruivo/devtools/flutter
• Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
I had a similar a problem, i tried to downgrade the flutter version to 1.12.13+hotfix.8 . But i still have the same error.
The result of building with file_picker: ^1.4.0:
Deprecated` Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 1 executed, 16 up-to-date
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:12: error: cannot find symbol
import androidx.lifecycle.DefaultLifecycleObserver;
^
symbol: class DefaultLifecycleObserver
location: package androidx.lifecycle
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:19: 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.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:35: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:42: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:46: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:50: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:54: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:58: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:63: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:253: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:254: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:262: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerDelegate.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
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 3s
**The plugin file_picker could not be built due to the issue above.
and my flutter doctor output:**
C:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel unknown, v1.12.13+hotfix.8, on Microsoft Windows [Versión 10.0.18362.720], locale es-ES)
• Flutter version 1.12.13+hotfix.8 at C:\flutter
• Framework revision 0b8abb4724 (8 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\LBO880\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Users\LBO880\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Process finished with exit code 0
@oumi there must be something on your machine that results in this. Maybe gradle version incompatibility? I’m trying to figure what but I can’t seem to be able to replicate the issue as it always builds successfully.
Mind to try the example project provided with the plugin?
Thank you.
@oumi mind to try the solution described here on the Wiki troubleshooting? Thank you.
I have the same issue.
When building the app I get an error specifying that FilePickerDelegate.java uses a deprecated API. And when I want to show the window to select the file, I get the following error:
I/flutter (20357): [FilePicker] Unsupported operation. Method not found. The exception thrown was: MissingPluginException(No implementation found for method ANY on channel file_picker)
E/flutter (20357): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method ANY on channel file_picker)
Plug-in version: 1.6.2 My Flutter version:
Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.12.13+hotfix.9 at
• Framework revision f139b11009 (10 days ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
In the GeneratedPluginRegistrant.java I can't find the plugin. I tried the solution from the Wiki section, and multiple cleans and builds, but nothing worked.
@phillausofia looks like you are still invoking FilePicker.ANY instead of FilePicker.any so I believe that this is some cached package issue (from previous versions).
Make sure you are calling using camelCase enum.
Eventually I found the glitch:
the previous developer copied the file_picker.dart file from the plugin and added it directly to the code, so all the classes where imported from that file. I've deleted that file and all the previous cached versions of the plug-in (there were quite a few) and now it works.
I have the same problem with Flutter 1.12.13+hotfix.9 * and *file_picker 1.6.2 . I can't build now
@cavinpabua post your logs please.
I had a similar a problem, i tried to downgrade the flutter version to 1.12.13+hotfix.8 . But i still have the same error. The result of building with file_picker: ^1.4.0:
Deprecated` Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 1 executed, 16 up-to-dateC:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:12: error: cannot find symbol
import androidx.lifecycle.DefaultLifecycleObserver;
^
symbol: class DefaultLifecycleObserver
location: package androidx.lifecycle
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:19: 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.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:35: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:42: error: method does not override or implement a method from a supertype
@override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:46: error: method does not override or implement a method from a supertype
@override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:50: error: method does not override or implement a method from a supertype
@override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:54: error: method does not override or implement a method from a supertype
@override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:58: error: method does not override or implement a method from a supertype
@override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:63: error: method does not override or implement a method from a supertype
@override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:253: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:254: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:262: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.5.1\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerDelegate.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errorsFAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.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 3s
**The plugin file_picker could not be built due to the issue above.
and my flutter doctor output:**
C:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel unknown, v1.12.13+hotfix.8, on Microsoft Windows [Versión 10.0.18362.720], locale es-ES)
• Flutter version 1.12.13+hotfix.8 at C:\flutter
• Framework revision 0b8abb4724 (8 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\LBO880\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Users\LBO880\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDKRuntimeEnvironment (build 1.8.0_212-release-1586-b04)[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)• No issues found!
Process finished with exit code 0
I have the exact same logged errors as @oumi but with version 1.6.2
@cavinpabua this looks like the project needs to me migrated to support v2 (probably that’s a project that started sometime ago). Check the troubleshooting section on the Wiki for Android.
@miguelpruivo I started this project just last month and upon seeing the troubleshooting section all is in order. I have v2 still the error persist. I'm focusing on error: cannot find symbol import androidx.lifecycle.DefaultLifecycleObserver; maybe it gives some lead. maybe this can help
@cavinpabua this os odd as if it were because of that, it should happen to _everyone_ that uses the plugin (including myself).
Could you please run the example app provided with the package and let me know if it worked for you?
Thank you.
@cavinpabua after further investigation, and based on your logs, you are using a cached version of 1.5.1. Please, update the plugin to the latest version and see if it still happens for you (you might need to completely remove the cache from your .pub_cache folder).
Also, to all in this thread, please check this answer and see if it helps.
Thank you.
@miguelpruivo I have moved my version to 1.6.2 which is the latest and still got the error below:
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\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:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\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:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:36: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:43: error: method does not override or implement a
method from a supertype
@Override
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:47: error: method does not override or implement a
method from a supertype
@Override
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:51: error: method does not override or implement a
method from a supertype
@Override
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:55: error: method does not override or implement a
method from a supertype
@Override
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:59: error: method does not override or implement a
method from a supertype
@Override
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:64: error: method does not override or implement a
method from a supertype
@Override
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:251: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:252: error: incompatible types: FilePickerPlugin.L
ifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:260: error: incompatible types: FilePickerPlugin.L
ifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.orgfile_picker-1.6.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerDelegate.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
I also have repeatedly deleted the pub.dartlang.org folder manually to ensure clear cache but the error still persist. Am I doing something wrong?
After some investigation with reference to stackoverflow and android jetpack
I manually added the following to flutter_file_picker android/build.gradle and reduced the error from 12 to 1 error:
REMAINING ERROR
C:\Users\user\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.6.2\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
1 error
ADDED TO BUILD.GRADLE
implementation "androidx.lifecycle:lifecycle-runtime:2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
@cavinpabua thank you for the effort. Like I said, you shouldn’t need that dependency at all, otherwise it would be happen to all plugin users including myself since V2 support was added.
We need to dig in the origin cause. Have you checked this?
@miguelpruivo yes my whole project is in androidx now.
my project:
android/app/build.gradle
compileSdkVersion 28
targetSdkVersion 28
android/gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
This is one of those Android mysterious things @cavinpabua, it's not easy specially when I can't replicate it, but I might have found something relevant.
If this is not happening to everyone, leads me to the conclusion that it has to be with Flutter engine itself differences on different versions — and so it seems, like in this open issue.
Basically, some people report to have the same problem with other packages due to some version, and, the one thing that I found in common with _all_ of you on this issue, is that you are running on Windows, while I'm on a Mac, so that's probably something related to the engine + OS platform.
Could you please try to flutter clean then project and then switch to flutter channel master and rebuild it again?
Thank you!
@miguelpruivo Tried flutter clean and flutter channel master with flutter upgrade and upon rebuilding the issue still remains. You mentioned that you're on Mac, I will try to make some virtual machine with Ubuntu Linux and will try to build my project in there. I will get back on this thread.
@cavinpabua that's quite an effort, but should point us toward the right direction if that works.
Thank you.
@miguelpruivo I took me sometime to setup the environment but the issues still persist. The logs are as follows:
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/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
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/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
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:36: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:43: error: method does not override or implement a method from a supertype
@Override
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:47: error: method does not override or implement a method from a supertype
@Override
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:51: error: method does not override or implement a method from a supertype
@Override
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:55: error: method does not override or implement a method from a supertype
@Override
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:59: error: method does not override or implement a method from a supertype
@Override
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:64: error: method does not override or implement a method from a supertype
@Override
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:251: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:252: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
/home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:260: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: /home/cavin/Downloads/flutter_linux_v1.12.13+hotfix.9-stable/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.6.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
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.
@cavinpabua does that happen when you run the example app from the plugin?
@miguelpruivo aaaaand yeah the example app from the plugin builds without a problem.
I just wonder why me and @oumi have the same problem where in fact we just use the plugin as usual.
I also want to mention that my project's android language is Kotlin while the example app, I believe, is in Java. Could it be a reason?
@cavinpabua hum, could it be related? I don't know. But I'll try to create an empty project with Kotlin as Android support and see if I can replicate it (I wish I could, worse that errors, are those that you can't replicate in order to implement a fix).
Sorry for not replying before.
Now, i downloaded for the second time the example of @miguelpruivo and it worked without doing anything else (the same example didn't work two weeks before). And i used the last version of file picker on my project also and it worked. I have to say also that i'm using windows. I don't know what's new in this last version...
Any way, many thanks guys!!.
If you need me to check something to help you to find the problem, tell me please.
This still looks like cache issues conflicts to me @oumi, which makes it harder to address. Have you updated your Flutter version in the meantime? Thanks!
Actually, last week i tried a lot of things like upgrading gradle (now i have 5.6.4 version) and i don't think that i did anything else.
May be the combination of the new version of the plugin and the gradle 5.6.4 worked.
Anyway, this is the result of my flutter doctor:
[√] Flutter (Channel unknown, v1.12.13+hotfix.8, on Microsoft Windows [Versión 10.0.18362.778], locale es-ES)
• Flutter version 1.12.13+hotfix.8 at C:\flutter
• Framework revision 0b8abb4724 (10 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\LBO880\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Users\LBO880\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
@cavinpabua would you mind to set your gradle version to 5.6.4 to see if it might be related and actually provide a fix? 🕵️♂️
Thanks @oumi.
@miguelpruivo
The same issue here
[✓] Flutter (Channel beta, v1.17.0, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
gradle 5.6.4
flutter_file_picker/example works fine
If example works fine, maybe you can try to see what dependencies have differences on both? Looks like an Android dependencies issue to me.
I've switched to 1.4.3+2 and now everything works.
I haven't noticed much difference between android folder in example and android folder in my project. The main difference is that my project uses kotlin.
@marchellodev it looks like this is affecting users with Kotlin projects, I'll keep you updated. Switching to 1.4.3 you'll be losing some of the new features such as multiple file extension filters and so on, but if you don't need them as of now, stick with it for now.
I have the similar issue when i add android:requestLegacyExternalStorage="true" this line to Androidmainfest.xml.The logs are as follows:
/Users/qitianle/Desktop/flutter/.pub-cache/hosted/pub.flutter-io.cn/file_picker-1.6.3+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:20: 错误: 找不到符号
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;
^
符号: 类 FlutterLifecycleAdapter
位置: 程序包 io.flutter.embedding.engine.plugins.lifecycle
1 个错误
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
@atheist1 also on a Kotlin project?
@atheist1 also on a Kotlin project?
I am not sure about it, I am a new developer to flutter.
but i guess it is a pure flutter project cause it's created by android studio onstart a new flutter projectchoice.
And its build with no error if i don't add theandroid:requestLegacyExternalStorage="true"but i can pick pdf file on android Q.
Joining this thread with the same issue.
What I'm using:
```
file_picker: ^1.8.0+1
~ $ flutter --version
Flutter 1.18.0-9.0.pre.38 • channel master • https://github.com/flutter/flutter.git
Framework • revision ffcf1db3ca (11 hours ago) • 2020-04-27 17:41:42 -0700
Engine • revision 4bcfae82c7
Tools • Dart 2.9.0 (build 2.9.0-3.0.dev a69cb6d700)
I'm on macOS Catalina 10.15.4 19E287 x86_64
```
The issue when building my application for android:
```
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+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
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+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
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:36: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:43: error: method does not override or implement a method from a supertype
@Override
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:47: error: method does not override or implement a method from a supertype
@Override
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:51: error: method does not override or implement a method from a supertype
@Override
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:55: error: method does not override or implement a method from a supertype
@Override
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:59: error: method does not override or implement a method from a supertype
@Override
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:64: error: method does not override or implement a method from a supertype
@Override
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:253: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:254: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
/Users/jagmit/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.8.0+1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:262: 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.
What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
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 4s
Exception: The plugin file_picker could not be built due to the issue above.
```
What I've already checked/tried:
flutter cleanand flutter pub cache repair android:requestLegacyExternalStorage="true" in my manifestfile_picker does work fineI'm on macOS so I don't think the issue lies here.
My MainActivity is in Kotlin so this might be a hint.
@miguelpruivo any direction where we could investigate this further?
@jagmit if I have the time, today I'll create a sample project with Kotlin and see if I can replicate it. If so, then that's the main lead. I'll keep in touch.
Just tried with transforming my MainActivity from Kotlin to Java and the issue is still there.
Same with pointing my manifest directly to the FlutterActivity coming from Flutter itself like:
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
....
@jagmit I believe that it must be some config property, we just need to find which one. Because running the plugin on Java projects works just fine.
Ok, so, basically I created an empty project (with Kotlin support) and was able to immediately build without an error at all (compileSdk: 29) both with android:requestLegacyExternalStorage="true" and not.
minSdkVersion 21
targetSdkVersion 29
So, here my files and please, anyone in this thread, can compare and see if anything helps:
gradle.version=5.6.2
android/build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any news on this?
Any news on this?
It's works fine if i do not add addandroid:requestLegacyExternalStorage="true"
@atheist1 on which version? Then don’t add it at all. That’s only for Android Q versions when your buildSdk is set to 29.
Bumping this thread, were anyone able to find the culprit for it and/or solution?
I faced the same issue when creating fresh project is builds fine but with other plugins its not so i tried to check every plugin i use with this plugin and found the issue in keyboard_visibility
it uses sdk 27 may be this is the issue may be not but when i don't use it the app builds
if some one faces the same issue please check your plugins may be one of them has the same issue
for people who need keyboard_visibility to work with this plugin please enter keyboard_visibility plugin in this path
$flutter_home\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle and change sdk version manually to 28
@mo-ah-dawood thank you for your input. Definitely some other plugins might need to be updated and could result in build conflicts. In that case, you should always open an issue with the oldest plugin that needs to be updated.
Nevertheless, I’m not sure if there wasn’t people here that tried it with an empty project.
I add the same issue : Make sure your images in @drawable are real png. I had this issue with flutter_native_splash plugin. That was the case for me I generated @drawable images online. They come with .png extension but didn't have real png signature. I used photoshop to export them in png and that solved my problem
创建新项目时,我遇到了同样的问题,但是构建良好,但是使用其他插件却不行,所以我尝试检查我与此插件一起使用的每个插件,发现
keyboard_visibility
其中使用sdk 27的问题可能是这个问题,但是当我不使用它构建的应用程序如果有人遇到相同的问题,请检查您的插件可能是其中一个具有相同的问题
对于需要
keyboard_visibility使用此插件的人,请keyboard_visibility在此路径中输入插件,
$flutter_home\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle然后将sdk版本手动更改为28
这种方式解决了问题
@miguelpruivo Hey ! I am facing this expection while flutter build apk
FAILURE: Build failed with an exception.
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
(This is taking an unexpectedly long t
Execution failed for task ':downloads_path_provider:verifyReleaseResources'.Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
Android resource linking failed
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
C:\Users\SIVARAM\.gradle\caches\transforms-2\files-2.1\290377ef3f04af0b2bf13aa0b54ad202\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
C:\Users\SIVARAM\.gradle\caches\transforms-2\files-2.1\290377ef3f04af0b2bf13aa0b54ad202\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
(This is taking an unexpectedly long t
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.
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t
BUILD FAILED in 6m 57s
Running Gradle task 'assembleRelease'...
(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t(This is taking an unexpectedly long t
Running Gradle task 'assembleRelease'... Done 419.2s (!)The built failed likely due to
AndroidX incompatibilities in a
plugin. The tool is about to try usingJetfier to solve the incompatibility.
Building plugin
downloads_path_provider...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 35.5s
√ Built build\app\outputs\repo.
Building plugin file_picker...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 44.7s
Configure project :
Observed package id 'system-images;android-23;google_apis;x86' in inconsistent location 'C:\Users\SIVARAM\AppData\Local\Android\Sdk.temp\PackageOperation04' (Expected 'C:\Users\SIVARAM\AppData\Local\Android\Sdk\system-images\android-23\google_apis\x86')
Observed package id 'system-images;android-25;google_apis;x86' in inconsistent location 'C:\Users\SIVARAM\AppData\Local\Android\Sdk.temp\PackageOperation09' (Expected 'C:\Users\SIVARAM\AppData\Local\Android\Sdk\system-images\android-25\google_apis\x86')
Observed package id 'system-images;android-25;google_apis;x86' in inconsistent location 'C:\Users\SIVARAM\AppData\Local\Android\Sdk.temp\PackageOperation13' (Expected 'C:\Users\SIVARAM\AppData\Local\Android\Sdk\system-images\android-25\google_apis\x86')
Already observed package id 'system-images;android-25;google_apis;x86' in 'C:\Users\SIVARAM\AppData\Local\Android\Sdk.temp\PackageOperation09'. Skipping duplicate at 'C:\Users\SIVARAM\AppData\Local\Android\Sdk.temp\PackageOperation13'
Task :assembleAarRelease UP-TO-DATE
Task :preBuild UP-TO-DATE
Task :preReleaseBuild UP-TO-DATE
Task :compileReleaseAidl NO-SOURCE
Task :compileReleaseRenderscript UP-TO-DATE
Task :checkReleaseManifest UP-TO-DATE
Task :generateReleaseBuildConfig UP-TO-DATE
Task :generateReleaseResValues UP-TO-DATE
Task :generateReleaseResources UP-TO-DATE
Task :packageReleaseResources UP-TO-DATE
Task :processReleaseManifest UP-TO-DATE
Task :generateReleaseRFile UP-TO-DATE
Task :prepareLintJar UP-TO-DATE
Task :generateReleaseSources UP-TO-DATE
Task :javaPreCompileRelease UP-TO-DATE
Task :compileReleaseJavaWithJavac FAILED
Task :mergeReleaseConsumerProguardFiles UP-TO-DATE
Task :mergeReleaseShaders UP-TO-DATE> Task :compileReleaseShaders UP-TO-DATE
Task :generateReleaseAssets UP-TO-DATE
Task :packageReleaseAssets UP-TO-DATE
Task :packageReleaseRenderscript NO-SOURCE
Task :processReleaseJavaRes NO-SOURCE
Task :compileReleaseNdk NO-SOURCE
Task :mergeReleaseJniLibFolders UP-TO-DATE
Task :transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
Task :transformNativeLibsWithSyncJniLibsForRelease UP-TO-DATE
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 1 executed, 16 up-to-date
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\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.lifecycleC:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\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.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:36: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class FilePickerPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:43: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:47: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:51: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:55: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:59: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:64: error: method does not override or implement a method from a supertype
@Override
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:262: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:263: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
C:\flutter.pub-cache\hosted\pub.dartlang.orgfile_picker-1.10.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:271: 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.
What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
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 44s
The plugin file_picker could not be
built due to the issue above.
My plugins :
bloc: ^4.0.0
flutter_bloc: ^4.0.0
dio: ^3.0.9
equatable: ^1.1.1
flutter_screenutil: ^1.1.0
json_annotation: ^3.0.1
shared_preferences: ^0.5.7
fluttertoast: ^4.0.1
cached_network_image: ^2.2.0
pin_code_text_field: ^1.5.1
sticky_headers: ^0.1.8
intl: ^0.16.1
multi_image_picker: ^4.6.7
image_picker: 0.6.2
downloads_path_provider: ^0.1.0
permission_handler: ^5.0.0+hotfix.3
photo: ^0.4.8
image_cropper: ^1.2.1
path_provider: ^1.6.7
chewie: ^0.9.10
firebase_messaging: ^6.0.16
open_file: ^3.0.1
flutter_facebook_login: ^3.0.0
page_view_indicators: ^1.3.1
linkedin_login: ^1.1.3
video_player: ^0.10.9+1
google_places_picker: ^2.1.0+1
flutter_downloader: ^1.4.4
uni_links: ^0.2.0
flutter_html: ^0.11.1
event_bus: ^1.1.1
flutter_uploader: ^1.2.0
flutter_image_compress:
git:
url: https://github.com/OpenFlutter/flutter_image_compress
file_picker: ^1.9.0+1
flutter_full_pdf_viewer: ^1.0.6
video_thumbnail: ^0.2.1
flutter_local_notifications: ^1.4.2
photo_view: ^0.9.2
Could you please help me out ?
@ThalapathySiva I really would like to help you but as you can see over this discussion, this looks like on of "those" Android issues where some versions conflict, be it gradle, cache or even project setup dependencies. I've spent so much time around this without any concrete conclusions as it's almost impossible to replicate it on my machine.
My best bet, is that you might have started your project some time ago and some dependencies have been updated, either gradle or Android V2 embedded support. Please, try creating a new project and copy/paste your source code into it and see if it still happens.
If you manage to replicate it with the example app, then there must be an issue with the plugin, otherwise, it's probably related to your project dependencies resolution. Check here the wiki for this issue.
I'm sorry to not be able to help you more than this.
I finally fixes this issue for me by
flutter create'ing a new app with the same name etcandroid/ directory over to my project android/ directory to my needs (manifest, permission, icons, signing etc)This was the only way I could fix this. I don't think this has anything to do with your plugin @miguelpruivo because when I removed it as a dependency the same error kept coming up with other libraries (some of them official one's from google/flutter!).
One possible reason could be that I did the migration to the Android v2 embedding manually but maybe the official guide is missing something that later caused this issue.
Anyways thank you very much @miguelpruivo for being so concerned and helpful! And of course for your contribution itself :)
@jagmit thank you so much for your input, as this issue is being kept here for a while with no further conclusions. Its inconsistency makes it almost to debug/fix and, like you've mentioned, in the end it seems to be not related to the plugin itself.
I'll add those steps to the troubleshooting for this on the Wiki and close this.
For anyone experiencing this, please, check this steps for a possible resolution.
Thank you all for your comprehension!
I was also struggling with this error and could not build after upgrading to Flutter 1.17.0.
After trying out the other suggestions, I found a way to find the problem. Sharing it here if it helps.
Below are the steps using which I could locate the issue and build my apk:
I know this issue is closed, but for future readers looking into the same issue I figured I would leave my experience, In short, I had been developing with the plug-in for a while, then updated Android Studio and these errors popped up with ^1.12.0 installed. I tried pretty much everything with no luck. In the end, I simply created a new project and copied everything over. Had to change min SDK from 16 to 21 and that was it, Worked just fine. Not sure what happened during the update, but it was not the file_picker plug-in for me.
@jclink @abhilashahyd These solutions aren't realistic and time consuming for a production used big app where there are some platform implementations. However, following steps solved the problem:
flutter clean.flutter build apk.solved the problem. But these exact same steps doesn't solved with early flutter versions(must upgrade to latest flutter).
I suspect that Android V2 embedded support is only fully supported on latest stable and prior stable versions (such as 1.12) will result in weird issues and some plugins conflicting, making it really hard to debug or even find the culprit.
To anyone reading this, I suggest the above answers (thank you 🙏 ) and also to make sure that you are running the latest Flutter stable version.
Facing the same issue
Execution failed for task ':compileReleaseJavaWithJavac'.
For anyone else that ends up here, I recently created a brand new project using Flutter v1.17.5 + File Picker 1.12.0 and ran into the same error. The root cause was needing to update my compileSdkVersion and targetSdkVersion to 29 as it seems they were needed for android:requestLegacyExternalStorage="true".
@jamesdixon that's correct. android:requestLegacyExternalStorage="true" will only work on 29 sdk or above.
I got the same issue like @Blasanka
I got two issues.
One is with my app icon png. I fixed it first.
Then File Picker issue!
`
Task :compileReleaseJavaWithJavac FAILED
Task :mergeReleaseConsumerProguardFiles
Task :mergeReleaseShaders
Task :compileReleaseShaders
Task :generateReleaseAssets
Task :packageReleaseAssets
Task :packageReleaseRenderscript NO-SOURCE
Task :processReleaseJavaRes NO-SOURCE
Task :compileReleaseNdk NO-SOURCE
Task :mergeReleaseJniLibFolders
Task :transformNativeLibsWithMergeJniLibsForRelease
Task :transformNativeLibsWithSyncJniLibsForRelease
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 17 executed
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/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
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:275: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:276: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
/Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:284: 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.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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 10s
The plugin file_picker could not be built due to the issue above.
`
### What I did is
I went to this location /Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.12.0/ and deleted file picker directory.
Then build the project without running Pug get. I showed error that File picker directory not found.
Then I ran Pug get command. Then I built it. Worked Fine.
I got this output
` flutter build apk --split-per-abi
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :firebase_auth_web not found. Please update settings.gradle.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/samsudeenfaslurajan/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Calling mockable JAR artifact transform to create file: /Users/samsudeenfaslurajan/.gradle/caches/transforms-2/files-2.1/4912cd979e3a783c645c4437af5adbfb/android.jar with input /Users/samsudeenfaslurajan/Library/Android/sdk/platforms/android-30/android.jar
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 123.7s (!)
✓ Built build/app/outputs/apk/release/app-armeabi-v7a-release.apk (14.3MB).
✓ Built build/app/outputs/apk/release/app-arm64-v8a-release.apk (14.6MB).
✓ Built build/app/outputs/apk/release/app-x86_64-release.apk (14.8MB).
`
`[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.5 19F101, locale en-GB)
• Flutter version 1.17.5 at /Users/samsudeenfaslurajan/Documents/flutter
• Framework revision 8af6b2f038 (11 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at /Users/samsudeenfaslurajan/Library/Android/sdk
• Platform android-30, build-tools 30.0.0
• ANDROID_HOME = /Users/samsudeenfaslurajan/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.47.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.2
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
`
@faslurrajah this issue has a described solution on troubleshooting section of the wiki.
@faslurrajah this issue has a described solution on troubleshooting section of the wiki.
I posted the way I solved this problem. Please take a look.
import androidx.lifecycle.DefaultLifecycleObserver;
^
symbol: class DefaultLifecycleObserver
location: package androidx.lifecycle
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:275: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:276: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.addObserver(this.observer);
^
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:284: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: /Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
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 3s
@faslurrajah i tried solution but did not work
@prataps19 check here.
i tried by creating new project but did not work .. is there any other solution @miguelpruivo
@prataps19 make sure you are running Flutter 1.17 or above.
[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15 19A583, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.3)
[!] Connected device
! No devices available
Flutter doctor result
Is there any way i can fix it??
@prataps19 honestly, I don't see a reason why you're having this issue. Bad caches or something like that. Run pub cache repair
@miguelpruivo I have solved by adding this "implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version""
but now i am getting this
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/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
/Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:275: error: cannot find symbol
this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
^
symbol: variable FlutterLifecycleAdapter
location: class FilePickerPlugin
Note: /Users/prataps/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.13.2/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
Compilation failed; see the compiler error output for details.
and i have tried pub cache repair
Looks like your project started prior to Android X and now there's some migration issues. Would you mind trying on a fresh new project without anything else? If it works, then it's something related to the project itself and you should be able to find it from there.
one of possible reason of these error is default version of Gradle, that not support
Hi @akhokhlushin this is also on the wiki troubleshooting since yesterday. Thank you!
this work for me:
https://android-developers.googleblog.com/2020/07/preparing-your-build-for-package-visibility-in-android-11.html
update gradle, look the table
classpath 'com.android.tools.build:gradle:X.X.Y'
I'm still not being able to build for android. I even tried rm -rf android/ & flutter create .
ignacio@manzana:~/repo/dash$ flutter run -d emulator-5554
Using hardware rendering with device sdk gphone x86 arm. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/home/ignacio/repo/dash/build/file_picker/intermediates/library_manifest/debug/AndroidManifest.xml:9:5-15:15: AAPT: error: unexpected element <queries> found in <manifest>.
* 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 25s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 26.5s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
✏️ Creating `android/settings_aar.gradle`... 2ms
✓ `android/settings_aar.gradle` created successfully.
Building plugin file_picker...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1.2s
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/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);
^
/home/ignacio/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.13/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:287: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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 1s
Exception: The plugin file_picker could not be built due to the issue above.
ignacio@manzana:~/repo/dash$
ignacio@manzana:~/repo/dash$ flutter doctor -v
[✓] Flutter (Channel beta, 1.23.0-18.1.pre, on Linux, locale en_US.UTF-8)
• Flutter version 1.23.0-18.1.pre at /home/ignacio/flutter
• Framework revision 198df796aa (4 weeks ago), 2020-10-15 12:04:33 -0700
• Engine revision 1d12d82d9c
• Dart version 2.11.0 (build 2.11.0-213.1.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /home/ignacio/Android/Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /home/ignacio/Android/Sdk
• Java binary at: /home/ignacio/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio
• Android Studio at /home/ignacio/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.51.1)
• VS Code at /usr/share/code
• Flutter extension version 3.16.0
[✓] Connected device (3 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.198
• No issues found!
ignacio@manzana:~/repo/dash$
@i5o check the troubleshooting section on the Wiki. You'll likely find a solution there as this is a "random" common issue.
I am also facing same error
one of possible reason of these error is default version of Gradle, that not support tag. Solution is here: https://stackoverflow.com/questions/62969917/how-do-i-fix-unexpected-element-queries-found-in-manifest/62969918#62969918
This worked
i try every solution but still got "androidx.lifecycle.DefaultLifecycleObserver". at last i remove 1 by 1 dependencies in pubspac and found clipboard_manager 0.0.1 if delete it my app can build now.
Still facing this issue.
C:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\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:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:287: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
this.lifecycle.removeObserver(this.observer);
^
Note: C:\Users\hp\AppData\Local\Pub\Cache\hosted\pub.dartlang.orgfile_picker-3.0.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
I try below solution
multiDexEnabled true
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
Most helpful comment
this work for me:
https://android-developers.googleblog.com/2020/07/preparing-your-build-for-package-visibility-in-android-11.htmlupdate gradle, look the table
classpath 'com.android.tools.build:gradle:X.X.Y'