cocos构建 Android 项目Android studio gradle 8.0 报错

记录一下踩坑 今天用cocos构建 了一个Android 项目 然后用Android studio 打开 TestProject_Helloworld\build\android\proj 项目, 由于我的Android studio 用的是jdk17, 所以提示要升级gradle 插件版本,所以我升级成了gradle 8.0 . 但是编译的时候报错

Namespace not specified. Please specify a namespace in the module’s build.gradle file like so:
android {
namespace ‘com.example.namespace’
}

然后在libservice 里加了namespace 后又在报
libcocos 的
Namespace not specified. Please specify a namespace in the module’s build.gradle file like so:
android {
namespace ‘com.example.namespace’
}

在proj里找不到 libcocos 这个module 。 后面发现路径是
在这里插入图片描述
C:\ProgramData\cocos\editors\Creator\3.7.3\resources\resources\3d\engine\native\cocos\platform\android 里
找到这个module grdle 加入 namespace

因为之前一直没找到这个libcocos,所以没用上面方法解决 。后续是我又重新构建了一个项目,打开之后提示升级grdle。我点Android studio的提示自动升级成 7.2
在这里插入图片描述
编译的时候报错 No variants found for ‘:TestProject_Helloworld’. Check build files to ensure at least one variant exists. at:

发现这里用的是4.1 ,版本不符合,。
在这里插入图片描述

找到对应的版本 7.1 就编译通过了
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/ok6671552/article/details/131214080