问题描述
我出口通过建设 AAR
有摇篮的Android库,我有内部的 JAR
要求 AAR
:基本上,我需要的jar以反映已经在项目中存在(JPEG文件应该是java包内一起的.class $ C以下文件结构$ C>文件):
I exporting Android library via building aar
with Gradle, and I have requirements for the jar
inside the aar
: Basically I need the jar to reflect following files structure that already exist in the project (jpeg files should be inside java package alongside .class
files):
project_name
|
module_name
|
src
|
main
|
java
|
package_to_include
|
java_files
jpeg_files
package_to_exclude
这是有关部分从的build.gradle
脚本:
apply plugin: 'com.android.library'
android {
...
sourceSets {
main {
java {
srcDir 'src/main/java'
exclude 'package_to_exclude/**'
resources.includes = [ 'package_to_include/*.jpeg' ]
}
resources {
srcDir 'src/../lib'
}
}
}
}
结果:排除部分作品中,不包括:在里面package_to_include罐子现在只有Java源代码code文件为的.class
文件。为JPEG不是在罐子都没有。
Result: The exclude part works, the include not: In the jar inside package_to_include there are only the java source code files as .class
files. The jpeg's not in the jar at all.
这是我不完全熟悉的双astrix(**)运算符的方式。也许这是解决方案的方向?
By the way I'm not totally familiar with the double astrix (**) operator. Maybe this is the direction for solution?
谢谢,
推荐答案
当你怀疑 **
是缺少的组成部分。猜测的路径包括可能是缺少的src / main / JAVA
preFIX到 package_to_include
。
As you suspect the **
is the missing component. Guessing the path to your include is probably missing the src/main/java
prefix to the package_to_include
.
**
意味着任何文件夹关禁起来。因此,例如:
**
means any folder reclusively. So for example:
src/main/java/package_to_include/image.jpg
src/main/res/image.jpg
// both would match
**/image.jpg
另外这行很奇怪 SRCDIR'SRC /../ lib目录
,因为它同 SRCDIR'库'
这篇关于Android的摇篮库的构建:包括&放大器;从生成的AAR里面的jar文件排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!