在构建的 APK 的根目录中包含一个文件
Including a file at the root of a built 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
对于遇到此问题的任何其他人,这似乎是一个已知问题 (https://issuetracker.google.com/issues/36911326)。
请注意,如果您将 Eclipse 与 ADT 一起使用,还有另一个问题,其中 "aapt.ignore.assets" 属性 被忽略 (https://issuetracker.google.com/issues/36961705)
我有一个 .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
对于遇到此问题的任何其他人,这似乎是一个已知问题 (https://issuetracker.google.com/issues/36911326)。
请注意,如果您将 Eclipse 与 ADT 一起使用,还有另一个问题,其中 "aapt.ignore.assets" 属性 被忽略 (https://issuetracker.google.com/issues/36961705)