Flutter Facebook登录:错误完成:Gradle任务assembleDebug失败,退出代码为1

构建Flutter项目时出现此错误。我刚刚在我的应用中设置了Facebook登录,然后构建就给了我-

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

我将项目迁移到AndroidX,但错误仍然存​​在。

我正在使用此版本的cloud_firestore-cloud_firestore: ^0.12.9+6

此外,AndroidX迁移似乎已经完成-(我在gradle.properties文件中看到了这一点- android.enableJetifier=true android.useAndroidX=true

我对这个问题一无所知。知道有什么问题吗?

谢谢!

flutter run -v

给我这个错误(这是错误的最后一位)

[ +100 ms] > Task :firebase_auth:generateDebugResValues UP-TO-DATE
[        ] > Task :firebase_auth:compileDebugRenderscript NO-SOURCE
[        ] > Task :firebase_auth:generateDebugResources UP-TO-DATE
[        ] > Task :firebase_auth:packageDebugResources UP-TO-DATE
[        ] > Task :firebase_core:generateDebugResValues UP-TO-DATE
[        ] > Task :firebase_core:compileDebugRenderscript NO-SOURCE
[        ] > Task :firebase_core:generateDebugResources UP-TO-DATE
[        ] > Task :firebase_core:packageDebugResources UP-TO-DATE
[  +97 ms] > Task :app:mergeDebugResources UP-TO-DATE
[        ] > Task :app:createDebugCompatibleScreenmanifests UP-TO-DATE
[        ] > Task :cloud_firestore:checkDebugManifest UP-TO-DATE
[        ] > Task :cloud_firestore:processDebugManifest UP-TO-DATE
[        ] > Task :firebase_analytics:checkDebugManifest UP-TO-DATE
[        ] > Task :firebase_analytics:processDebugManifest UP-TO-DATE
[        ] > Task :firebase_auth:checkDebugManifest UP-TO-DATE
[        ] > Task :firebase_auth:processDebugManifest UP-TO-DATE
[        ] > Task :firebase_core:checkDebugManifest UP-TO-DATE
[        ] > Task :firebase_core:processDebugManifest UP-TO-DATE
[        ] > Task :app:processDebugManifest UP-TO-DATE
[        ] > Task :cloud_firestore:parseDebuglibraryResources UP-TO-DATE
[        ] > Task :cloud_firestore:generateDebugRFile UP-TO-DATE
[        ] > Task :firebase_analytics:parseDebuglibraryResources UP-TO-DATE
[        ] > Task :firebase_analytics:generateDebugRFile UP-TO-DATE
[        ] > Task :firebase_auth:parseDebuglibraryResources UP-TO-DATE
[        ] > Task :firebase_auth:generateDebugRFile UP-TO-DATE
[        ] > Task :firebase_core:parseDebuglibraryResources UP-TO-DATE
[        ] > Task :firebase_core:generateDebugRFile UP-TO-DATE
[ +692 ms] > Task :app:processDebugResources FAILED
[        ]          *********************************************************
[        ] WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX.
[        ]          See <link> 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.
[        ]          *********************************************************
[        ] 52 actionable tasks: 5 executed,47 up-to-date
[ +370 ms] Running Gradle task 'assembleDebug'... (completed in 9.3s)
[   +3 ms] "flutter run" took 14,158ms.
Gradle task assembleDebug failed with exit code 1

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:751:5)
<asynchronous suspension>
#2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:494:14)
<asynchronous suspension>
#3      buildApk (package:flutter_tools/src/android/apk.dart:34:9)
<asynchronous suspension>
#4      AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:486:13)
<asynchronous suspension>
#5      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:378:54)
<asynchronous suspension>
#6      HotRunner.run (package:flutter_tools/src/run_hot.dart:254:39)
<asynchronous suspension>
#7      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:472:37)
<asynchronous suspension>
#8      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#9      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#10     _rootRunUnary (dart:async/zone.dart:1132:38)
#11     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#12     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#13     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#14     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#15     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#16     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#17     _completeonAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#18     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#19     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#20     _rootRunUnary (dart:async/zone.dart:1132:38)
#21     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#22     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#23     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#24     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#25     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#26     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#27     _completeonAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#28     AndroidDevice.isLocalEmulator (package:flutter_tools/src/android/android_device.dart)
#29     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#30     _rootRunUnary (dart:async/zone.dart:1132:38)
#31     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#32     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#33     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#34     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#35     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#36     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#37     _rootRun (dart:async/zone.dart:1124:13)
#38     _CustomZone.run (dart:async/zone.dart:1021:19)
#39     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#40     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#41     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#42     _startmicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#43     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#44     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)```



Blackboard123 回答:Flutter Facebook登录:错误完成:Gradle任务assembleDebug失败,退出代码为1

哦,天哪,刚发现问题!

在设置Facebook登录以防止混乱的同时,Facebook要求我们将此添加到清单中(除其他外)-

<activity android:name="com.facebook.FacebookActivity"
 android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
 android:label="@string/app_name" />

这期望app_name位于strings.xml

我将其添加到strings.xml文件-

<string name="app_name">My App Name</string>

成功了。

这花了我很多时间,希望对其他人有帮助。

本文链接:https://www.f2er.com/3157331.html

大家都在问