将资源文件安装到apk的根目录中 [英] Install resource file into root of apk

查看:77
本文介绍了将资源文件安装到apk的根目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将jar用作依赖项时,jar根目录中的所有文件都会放入生成的apk的根目录中.同时,如果我 just 有我的android项目,并且想将文件放在根目录中,那我就不会!我必须将文件放在 res/assets res/raw 中,这对我来说没有用.

When you use a jar as a dependency, any files in the jar root are put into the generated apk's root. Meanwhile, if I just have my android project, and I want to put files in the root, I can't! I have to put files in res/assets or res/raw, which won't do the trick for me.

我正在使用公司内部的一个库,它期望所生成工件的顶级文件具有文件名

I'm using a library internal to the company, and it expects a filename for something in the top-level of the produced artifact

推荐答案

对于旧的android项目(使用 ant 等的Android项目,请将您的资源文件放入/resources (不是/res ),以确保它们不会被 aapt 触及并置于根中.

With old android projects (the ones that use ant, etc), put your resource files in /resources (not /res) to ensure that they aren't touched by aapt and are put in the root.

对于新的android项目(使用 gradle 的项目),请将这些资源放在 src/main/resources

For new android projects (ones using gradle), put these resources in src/main/resources

这篇关于将资源文件安装到apk的根目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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