flutter Exception: Gradle task assembleDebug failed with exit code 1

Exception: Gradle task assembleDebug failed with exit code 1

solution:

This problem occurs, it may be that the dependent plug-in cannot be downloaded

Find the android->build.gradle of the project,

insert image description here

 Will

google()
mavenCentral()

changed to

        maven{url 'https://maven.aliyun.com/repository/google' }
        maven{url 'https://maven.aliyun.com/repository/google-plugin' }
        maven{url 'https://maven.aliyun.com/repository/public' }
        maven{url 'https://maven.aliyun.com/repository/jcenter' }

insert image description here

 Open packages->flutter_tools->grale->flutter.gradle in the flutter SDK
will

        maven{url 'https://maven.aliyun.com/repository/google' }
        maven{url 'https://maven.aliyun.com/repository/google-plugin' }
        maven{url 'https://maven.aliyun.com/repository/public' }
        maven{url 'https://maven.aliyun.com/repository/jcenter' }

Add to the front of google()

insert image description here

If the above method is still not resolved

Find the gradle-6.7-all file of your own problem , delete it, and download it again.

insert image description here

 If it doesn't work, it may be caused by the gradle package version, which does not match the version of your Androidstudio. Find the gradle-wrapper.properties fileinsert image description here

 Change the version of the gradle package, you can try to downgrade the version, the latest is not necessarily the best.

insert image description here

 Finally run successfully.

insert image description here

Guess you like

Origin blog.csdn.net/wangqing830414/article/details/131425700