任务':image_picker:compileDebugJavaWithJavac'的执行失败

时间:2019-12-11 04:23:59

标签: android firebase flutter flutter-dependencies

我不知道我的Flutter怎么了,收到此错误:

Launching lib\main.dart on NOTE 5 in debug mode...
Initializing gradle...                                             20.2s
Resolving dependencies...                                         149.7s (!)
Running Gradle task 'assembleDebug'...
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.11\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.11\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:15: error: package android.support.annotation does not exist

import android.support.annotation.VisibleForTesting;

                                 ^

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:16: error: cannot find symbol

import android.support.v4.app.ActivityCompat;

                             ^

  symbol:   class ActivityCompat

  location: package android.support.v4.app

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:17: error: package android.support.v4.content does not exist

import android.support.v4.content.FileProvider;

                                 ^

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerFileProvider.java:3: error: package android.support.v4.content does not exist

import android.support.v4.content.FileProvider;

                                 ^

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerFileProvider.java:10: error: cannot find symbol

public class ImagePickerFileProvider extends FileProvider {}

                                             ^

  symbol: class FileProvider

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:8: error: package android.support.annotation does not exist

import android.support.annotation.VisibleForTesting;

                                 ^

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:68: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_CODE_CHOOSE_IMAGE_FROM_GALLERY = 2342;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:69: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_CODE_TAKE_IMAGE_WITH_CAMERA = 2343;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:70: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_EXTERNAL_IMAGE_STORAGE_PERMISSION = 2344;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:71: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_CAMERA_IMAGE_PERMISSION = 2345;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:72: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_CODE_CHOOSE_VIDEO_FROM_GALLERY = 2352;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:73: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_CODE_TAKE_VIDEO_WITH_CAMERA = 2353;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:74: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_EXTERNAL_VIDEO_STORAGE_PERMISSION = 2354;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:75: error: cannot find symbol

  @VisibleForTesting static final int REQUEST_CAMERA_VIDEO_PERMISSION = 2355;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:77: error: cannot find symbol

  @VisibleForTesting final String fileProviderName;

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:164: error: cannot find symbol

  @VisibleForTesting

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerDelegate

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerPlugin.java:40: error: cannot find symbol

  @VisibleForTesting

   ^

  symbol:   class VisibleForTesting

  location: class ImagePickerPlugin

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:122: error: cannot find symbol

            return ActivityCompat.checkSelfPermission(activity, permissionName)

                   ^

  symbol: variable ActivityCompat

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:128: error: cannot find symbol

            ActivityCompat.requestPermissions(activity, new String[] {permissionName}, requestCode);

            ^

  symbol: variable ActivityCompat

C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:140: error: cannot find symbol

            return FileProvider.getUriForFile(activity, fileProviderName, file);

                   ^

  symbol: variable FileProvider

20 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 4m 35s
Running Gradle task 'assembleDebug'...                            287.0s (!)
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1

2 个答案:

答案 0 :(得分:0)

最后一个错误说:

The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app. See for more information on the problem and how to fix it.

您需要将Android模块迁移到AndroidX。现在,大多数浮动依赖项都是使用AndroidX构建的,因此您最好也升级项目。

在Android Studio或IntelliJ中,您可以通过访问菜单重构->迁移到AndroidX进行迁移...

答案 1 :(得分:0)

通过将image_picker版本更改为image_picker:^ 0.6.0 + 9