Сегодня я обновил Android-студию, и мой проект флаттера больше не работает. Gradle не работает со следующим сообщением:
* Error running Gradle:
ProcessException: Process "C:\Projects\firebase_setup_app\android\gradlew.bat" exited abnormally:
> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
*********************************************************
WARNING: This version of firebase_auth will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
Command: C:\Projects\firebase_setup_app\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
Я пытался создать новый проект флаттера в последней версии студии, и это нормально.
Проблема, похоже, заключается в том, что я использую сервисы Google Play и Firebase в своем проекте. Я обновил службы Google до последней версии (4.2.0) и перешел на версию 3.4.0, следуя подсказке IDE
Я обновил скомпилированную SDK версию с 27 до 28 в android / app / build.gradle
Я обновил версию gradle в android / gradle / gradle-wrapper.properties с 4.10.2 до 5.1.1, так как произошла несовместимость, и мне было предложено обновить.
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Я выполнил рефакторинг> мигрировал на AndroidX ... и включил:
android.useAndroidX=true
android.enableJetifier=true
в файле gradle.properties
Я попытался очистить кеш через «Файл> Неправильно кешировать и перезапустить ...»
Я попробовал очистить флаттер и врач -v без проблем:
C:\Projects\firebase_setup_app>flutter clean
Deleting 'build\'.
Deleting 'C:\Projects\firebase_setup_app\.dart_tool\'.
C:\Projects\firebase_setup_app>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 6.3.9600], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[√] IntelliJ IDEA Community Edition (version 2018.3)
[√] Connected device (1 available)
• No issues found!
C:\Projects\firebase_setup_app>flutter doctor -v
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 6.3.9600], locale en-GB)
• Flutter version 1.2.1 at C:\src\flutter\flutter_windows_v1.0.0-stable\flutter
• Framework revision 8661d8aecd (10 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 34.0.2
• Dart plugin version 183.5901
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] IntelliJ IDEA Community Edition (version 2018.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.3
• Flutter plugin version 31.3.4
• Dart plugin version 183.5153.38
[√] Connected device (1 available)
• SM G930F • ce0616069dbace2f03 • android-arm64 • Android 8.0.0 (API 26)
• No issues found!
Я также обновил зависимости android / build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
//classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
Зависимости android / app / build.gradle следующие:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
my pubspec.yaml включает следующие плагины:
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
google_sign_in: ^4.0.1+3
firebase_auth: ^0.8.4+5
firebase_core: ^0.3.4
#firebase_core: any
firebase_database: ^2.0.3
Любые предложения, пожалуйста, для решения очень признателен!