在cocos商店安装google admob扩展后,生成安卓文件出错

Cocos Creater 3.8.1

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:libadmob’.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Please specify a namespace in the module’s build.gradle file like so:

 android {
     namespace 'com.example.namespace'
 }
 
 If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

把gradle降级能解决,但是还是会出现其他报错.

环境配置了半天,打个包还一直出错

应该是android studio的版本高了不能用xml导入,这里需要将libadmob包下的AndroidManifest.xml 文件中的 package 替换到 libadmob 包下的build.gradle 文件中的namespace 字段中
https://juejin.cn/post/7431091997115564047