更新我的依赖后,例如cloud_firestore,firebase_auth,fluttertoast以及gradle和android studio ... 我已经运行了flutter clean,然后flutter build apk-v 它没有工作... 我将稳定版本切换到了主版本,但仍然没有更改相同的问题。 这是我的日志的一部分:
C:\sdk\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.13+1\android\src\main\java\io\flutter\plugins\fire
base\cloudfirestore\CloudFirestorePlugin.java:627: warning: [deprecation] setTimestampsInSnapshotsEnabled(boolean) in
Builder has been deprecated
[ +4 ms] builder.setTimestampsInSnapshotsEnabled(
[ +1 ms] ^
[ +299 ms] Note:
C:\sdk\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.13+1\android\src\main\java\io\flutter\plugins\fire
base\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
[ +3 ms] Note: Recompile with -Xlint:unchecked for details.
[ +1 ms] 1 warning
[ +3 ms] Note:
C:\sdk\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.3.4\android\src\main\java\io\flutter\plugins\firebase\
core\FirebaseCorePlugin.java uses unchecked or unsafe operations.
[ +2 ms] Note: Recompile with -Xlint:unchecked for details.
[ +8 ms]
C:\sdk\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-3.0.4\android\src\main\java\io\github\ponnamkarthik\toast
\fluttertoast\FluttertoastPlugin.java:84: warning: [deprecation] getDrawable(int) in Resources has been deprecated
[ +7 ms] shapeDrawable = ctx.getResources().getDrawable(R.drawable.toast_bg);
[ +4 ms] ^
[ +4 ms] 1 warning
[+1703 ms] > Task :app:packageRelease FAILED
[ +240 ms] *********************************************************
[ +70 ms] WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't
compatible with AndroidX.
[ +5 ms] See [https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility][here] for more information on the problem and how to fix it.
[ +2 ms] This warning prints for all Android build failures. The real root cause of the error may be
unrelated.
[ +1 ms] *********************************************************
[ +1 ms] 108 actionable tasks: 102 executed, 6 up-to-date
[ +744 ms] Running Gradle task 'assembleRelease'... (completed in 412,9s, longer than expected)
[ +9 ms] "flutter apk" took 597 734ms.
[ +11 ms] "flutter apk" took 597 734ms.
Gradle task assembleRelease failed with exit code 1
答案 0 :(得分:0)
您必须更新到AndroidX,还必须更新Firebase库。
https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
查看日志的这一部分:
[+240毫秒] ********************************************** *************** [+70毫秒]警告:如果该版本的cloud_firestore或其依赖项不正确,它将破坏您的Android构建 与AndroidX兼容。 [+5毫秒]有关此问题以及如何解决的更多信息,请参见[https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility][here]。 [+2毫秒]此警告将针对所有Android构建失败打印。错误的真正根本原因可能是 无关。 [+1毫秒] ************************************************* ************