简体   繁体   中英

Error: Gradle task assembleDebug failed with exit code 1 - after change package name in flutter project

Before changing the package name my app in Flutter was compiling normally, after I changed the name returns the error in android studio:

Gradle task assembleDebug failed with exit code 1

I've searched all my code for the old name and replaced it with the new one. I changed all the files (AndroidManifest.xml, MainActivity.java, build.grandle, pubspec.yaml and imports in .dart files) and also the folder name, but the problem persists.

I made one flutter clean but without success...

When entering the command flutter run -v return:

#0      throwToolExit (package:flutter_tools/src/base/common.dart:24:3)
#1      _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:478:5)
<asynchronous suspension>
#2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:346: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:377:13)
<asynchronous suspension>
#5      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:364:54)
<asynchronous suspension>
#6      HotRunner.run (package:flutter_tools/src/run_hot.dart:253:39)
<asynchronous suspension>
#7      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:428:37)
<asynchronous suspension>
#8      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:559:18)
#9      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77: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:126:18)
#13     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#14     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#15     Future._complete (dart:async/future_impl.dart:473:7)
#16     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#17     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:28:18)
#18     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:294:13)
#19     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#20     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77:64)
#21     _rootRunUnary (dart:async/zone.dart:1132:38)
#22     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#23     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#25     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#26     Future._complete (dart:async/future_impl.dart:473:7)
#27     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#28     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
#29     _rootRun (dart:async/zone.dart:1124:13)
#30     _CustomZone.run (dart:async/zone.dart:1021:19)
#31     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#32     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#33     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#34     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)

If anyone can give me any tips, thank you in advance.

Try to Invalidate Caches/restart option in the file options.

File >> Invalidate Caches/Restart

在此处输入图片说明

Thank you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM