什么是Android的一个摇篮“资源产生的任务”? [英] What is a 'resource-generating task' in Android Gradle?

查看:245
本文介绍了什么是Android的一个摇篮“资源产生的任务”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<一个href=\"https://www.reddit.com/r/androiddev/comments/3femjd/including_your_readme_file_to_your_resource/\"相对=nofollow>这 reddit的线程有一个解决方案,我的<一href=\"http://stackoverflow.com/questions/34595582/android-gradle-how-to-include-assets-from-the-root-project\">problems和<一个href=\"https://www.reddit.com/r/androiddev/comments/3femjd/including_your_readme_file_to_your_resource/ctoaoxo\"相对=nofollow>这个评论

This reddit thread has a solution to one of my problems and this comment

...一个更好的选择是创建一个任务,将文件复制到$ project.buildDir /自述/ RES /生/,注册该文件夹的Andr​​oid插件作为一个资源产生的根源,并注册任务与Android插件为资源生成任务

...a better option is to create a task which copies the file into "$project.buildDir/readme/res/raw/", register that folder with the Android plugin as a generated resource root, and register the task with the Android plugin as resource-generating task.

似乎在暗示一个更好的办法,但我不知道什么是'注册为一个资源产生的任务的含义。

seems to be suggesting a better way but I am not sure what is meant by 'register as a resource-generating task'.

推荐答案

好吧,认为这意味着注册到 mergeResources 任务像下面

Ok, think it means registering to mergeResources task like below

variant.mergeResources.doLast {
    copy {
       from ("path/to/some/file")
       into ("$outputDir/raw")
    }
}

这篇关于什么是Android的一个摇篮“资源产生的任务”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆