由于项目要引用第三方库,cocosCreator默认使用的gradle版本4.10.3无法满足需求!被迫升级!
- Android Studio 打开你的项目
- File -> Project Structure -> Project 选择 Android Gradle Plugin 4.4.2,Gradle 6.7.1
- 重新编译 或者关闭AS重新打开。
这时候不需要Android Studio 了。用Cocoscreate打开 编译-构建
不出意外应该会出现意外,提示无法下载Gradle
解决无法下载Gradle
1 直接复制报错的地址 到浏览器下载
2 查看这个这个目录找到对应版本号为名称的文件夹,打开以一串数字开头的文件夹(这个是creator用的,另一个是Android Studio用的不用管它):
C:\Users\Administrator\.gradle\wrapper\dists\gradle-6.7.1-bin\69322hda2otfrsehv694kklr42
3 把下载到的压缩包放进去 解压, 压缩包不要删除!
4 把gradle-6.7.1-bin.part 改成gradle-6.7.1-bin.ok
最终是这个样子:
修改配置
1、项目proj.android-studio/build.gradle修改:改成国内镜像
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// google()
// jcenter()
maven {
url 'https://maven.aliyun.com/repository/google'}
maven {
url 'https://maven.aliyun.com/repository/jcenter'}
maven {
url 'http://maven.aliyun.com/nexus/content/groups/public'}