unity3d与aar :android gradle自动任务task,build后复制aar至unity目录

2023-08-24 15:05:43 浏览数 (1)

代码语言:javascript复制
// 删除旧的aar
task deleteOldAar(type: Delete) {
    //删除Unity工程下的Android资源
    delete 'D:/UnityProjects/AcGame0403/Assets/Plugins/Android/acgame0403-release.aar'
}

//导出aar
task exportAar(type: Copy) {
    from('build/outputs/aar/')
    into('D:/UnityProjects/AcGame0403/Assets/Plugins/Android/')
    include('acgame0403-release.aar')
}


exportAar.dependsOn(deleteOldAar, build)

这段放在build.gradle最后面,然后通过点击as右侧gradle列表中的exportArr执行

0 人点赞