cocos build Android project Android studio gradle 8.0 error

Record stepping on the pit. Today I built an Android project with cocos and then opened the TestProject_Helloworld\build\android\proj project with Android studio. Since my Android studio uses jdk17, I was prompted to upgrade the gradle plug-in version, so I upgraded to gradle 8.0 . But an error is reported when compiling

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

Then add namespace in libservice and then report
libcocos
Namespace not specified. Please specify a namespace in the module's build.gradle file like so:
android { namespace 'com.example.namespace' }

The libcocos module cannot be found in proj. Later found that the path is
insert image description here
C:\ProgramData\cocos\editors\Creator\3.7.3\resources\resources\3d\engine\native\cocos\platform\android Find
this module grdle and add it to namespace

Because I haven't found this libcocos before, I didn't use the above method to solve it. The follow-up was that I rebuilt a project again, and after opening it, I was prompted to upgrade grdle. I clicked the Android studio prompt to automatically upgrade to 7.2
insert image description here
when compiling and reported No variants found for ':TestProject_Helloworld'. Check build files to ensure at least one variant exists. at:

It is found that 4.1 is used here, and the version does not meet the requirements.
insert image description here

Find the corresponding version 7.1 and compile it
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/ok6671552/article/details/131214080