آخرین سوالاتدسته بندی: فلاترخطا در استفاده از image_picker
razy 4 ماه قبل

سلام دوستان  من خظای زیر رو دریافت میکنم هر وقت میخوام از image_picker استفاده کنم ممنون میشم کمکم کنید

Launching lib\main.dart on Android SDK built for x86 in debug mode…
[!] Your app isn’t using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.
Running Gradle task ‘assembleDebug’…
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:15: error: cannot find symbol
import androidx.lifecycle.DefaultLifecycleObserver;
^
symbol: class DefaultLifecycleObserver
location: package androidx.lifecycle
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:33: error: cannot find symbol
implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
^
symbol: class DefaultLifecycleObserver
location: class ImagePickerPlugin
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:40: error: method does not override or implement a method from a supertype
@Override
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:43: error: method does not override or implement a method from a supertype
@Override
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:46: error: method does not override or implement a method from a supertype
@Override
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:49: error: method does not override or implement a method from a supertype
@Override
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:52: error: method does not override or implement a method from a supertype
@Override
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:57: error: method does not override or implement a method from a supertype
@Override
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:201: error: incompatible types: ImagePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
lifecycle.addObserver(observer);
^
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.6.7+9\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:209: error: incompatible types: ImagePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
lifecycle.removeObserver(observer);
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
۱۰ errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ‘:image_picker:compileDebugJavaWithJavac’.
> Compilation failed; see the compiler error output for details.
* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
AndroidX incompatibilities may have caused this build to fail. Please migrate your app to AndroidX. See https://goo.gl/CP92wY.
Finished with error: Gradle task assembleDebug failed with exit code 1

Hesam عضو سایت پاسخ داده شده 4 ماه قبل

داخل برنامه از AndroidX استفاده کنید.

saeed003 پاسخ داده شده 4 هفته قبل

با سلام
نوی اندروید استودیو فلاتر این خطا رو میده:Unable to locate a development device; please run ‘flutter doctor’ for information about installing additional components.
بعد از اجرای دستور flutter doctor این خطا رو میده
C:\Users\Saproge>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.10240], locale fa-IR)
[!] Android toolchain – develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.

X No valid Android SDK platforms found in C:\sdk\platforms. Candidates were:
– android-17
– android-19
– android-29
– android-30
– android-L
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.52.1)
[√] Connected device (1 available)

! Doctor found issues in 2 categories.
اندروید استودیو پورتال نصب کردم
فلاتر و sdk رو به enviroment vareiables معرفی کردم