Проект не будет компилироваться из-за Android X - PullRequest
0 голосов
/ 29 марта 2019

Я клонировал проект на Github.Он использует разные плагины.

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: 0.1.2
  firebase_auth: 0.7.0
  google_sign_in: 3.2.4
  cloud_firestore: 0.8.2+3
  image_picker: 0.4.12+1
  shared_preferences: 0.4.3
  firebase_storage: 1.0.4
  cached_network_image: 0.7.0
  intl: 0.15.7

Существует блог post , в котором рекомендуется сохранять версии одинаковыми.Моя проблема в плагине image_picker.Осматривая stackoverflow, он рекомендует использовать версию 0.4.12+1, если вы не хотите переносить приложение на Android X. Вот моя ошибка

/Users/gerardhorgan/Downloads/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;
                                 ^
/Users/gerardhorgan/Downloads/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;
                                 ^
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
/Users/gerardhorgan/Downloads/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
13 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.



BUILD FAILED in 2s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.

*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1

Мне интересно, что может быть причиной несовместимости, мешающей моему приложениюкомпиляции?

Ответы [ 2 ]

0 голосов
/ 29 марта 2019

Лучший вариант - перенести приложение на androidX.Следуйте инструкциям в android-studio:

1) Удалите все зависимости вашего файла pubspec и запустите flutter packages get

2) Откройте только android-модуль вашего приложения в android-studio.Вы можете сделать это, щелкнув правой кнопкой мыши по корневому каталогу вашего проекта> флаттер> Открыть модуль Android в Android Studio

3) После открытия только модуля Android в меню Android-Studio перейдите в Refactor> MigrateToAndoridX ...

4) Выполните миграцию!

5) Закройте экземпляр android-studio модуля android и вернитесь к своему проекту флаттера

6) Вставьте все ваши зависимости в файл pubspec и запустите flutter packages get

0 голосов
/ 29 марта 2019

Вам необходимо передать документацию для совместимости с AndroidX

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...