How to run copy task with android studio into assets folder

后端 未结 7 960
温柔的废话
温柔的废话 2020-12-01 11:53

So far I have added the following to the end of my \"build.gradle\"

task copyFiles(type: Copy)

copyFiles {
    description = \'Copies html5 files from the c         


        
7条回答
  •  离开以前
    2020-12-01 12:33

    Try this below your build.gradle:

    tasks.whenTaskAdded { task ->
        if (task.name == 'assemble') {
            task.dependsOn copyFiles
        }
    }
    

    In my case I manipulate some 'token' values inside res/values/strings.xml, and then copy it into ${project_root}/build/filtered-resources due to project cleaning issue.

    To work correctly with this manipulated resource, android.sourceSets.res should be redefined to copied folder.

    For your case copy assets folder with your www resource into ${PROJECT_ROOT}/build/your/desired/location, and asign android.sourceSets.assets point to it.

提交回复
热议问题