在内置APK的根目录中包含一个文件

时间:2018-09-28 10:44:46

标签: android resources apk

我有一个.properties文件,在构建的APK的根目录下需要。

问题在于,当文件以下划线开头(例如_xyz.properties)时,不会添加该文件, 但没有下划线,它会添加到根目录。

例如:

If I place a properties file within my project, called xyz.properties

and I add that file as a resource by adding the following in build.gradle:

sourceSets {
    main {
        resources.srcDirs = ['src/main/java/xyzLocation']
    }
}

When I build and inspect the created APK, the xyz.properties file is present at the root.

If I rename the file to _xyz.properties and build an APK again

_xyz.properties is not present within the APK

1 个答案:

答案 0 :(得分:0)

对于其他任何遇到此问题的人,这似乎是一个已知问题(https://issuetracker.google.com/issues/36911326)。

请注意,如果您将Eclipse与ADT结合使用,则还有另一个问题,即忽略了“ aapt.ignore.assets”属性(https://issuetracker.google.com/issues/36961705