建立Flutter版本Android应用程式失败

时间:2019-07-30 16:01:43

标签: firebase flutter

我最近开始构建Flutter应用程序,并且刚刚完成我的第一个项目,即使用Firebase在Google Play上运行类似应用商店的应用程序,它在调试模式下可以正常工作,但是当我尝试构建发行版APK时,它失败并显示:firebase_analytics:verifyReleaseResources消息

我尝试将pubspec.yaml中的firebase依赖关系更改为AndroidX之前的依赖关系,还尝试运行flutter clean但无济于事。

这是我的依赖项

dependencies:
  flutter:
    sdk: flutter

  firebase_core: ^0.3.0

  firebase_analytics: ^1.1.0

  firebase_storage: ^2.1.1+2

  firebase_database: ^1.0.5
  store_redirect: ^1.0.1

  cloud_firestore: ^0.9.8

  firebase_auth: ^0.9.0
  google_sign_in: ^3.2.4

  rxdart: 0.20.0

  cupertino_icons: ^0.1.2
  font_awesome_flutter: ^8.2.0
  carousel_slider: ^1.3.0

这是我在运行flutter run --release

时遇到的错误
Initializing gradle...                                              1.3s

Resolving dependencies...                                           4.6s

Launching lib\main.dart on TECNO CX Air in release mode...

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_analytics:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  C:\Projects\flutterExcersice\NestedTabs-master\flutternestedtabsapp\build\firebase_analytics\intermediates\res\merged\release\values\values.xml:276: error: resource android:attr/fontVariationSettings not found.
  C:\Projects\flutterExcersice\NestedTabs-master\flutternestedtabsapp\build\firebase_analytics\intermediates\res\merged\release\values\values.xml:277: error: resource android:attr/ttcIndex not found.
  error: failed linking references.


* 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 22s

Running Gradle task 'assembleRelease'...

Running Gradle task 'assembleRelease'... Done                      23.5s

Gradle task assembleRelease failed with exit code 1

1 个答案:

答案 0 :(得分:1)

回复较晚,但将其发布给以后的用户。

我也遇到了同样的错误。在发布版本中,调试版本也可以正常工作。

更新了所有的firebase和Google库之后,它开始工作。 我更新了所有这些库:-

  • firebase_core:^ 0.4.2
  • firebase_analytics:^ 5.0.6
  • firebase_auth:^ 0.15.0 + 1
  • cloud_firestore:^ 0.12.10 + 2
  • firebase_messaging:^ 6.0.1
  • google_sign_in:^ 4.0.14