相关疑难解决方法(0)

排除发布版本类型的资产

我正在使用gradle构建的应用程序中导入一个android库,如下所示:

dependencies {
    compile 'com.example:great-lib:0.1-SNAPSHOT'
}
Run Code Online (Sandbox Code Playgroud)

此库仅包含要在webview中使用的资源,js,css和图像,其布局如下:

assets/
|-> great.css
|-> great.min.js
|-> great.min.js.map
|-> js/
|   |-> plop.js
|   |-> foo.js
|   ...
|-> img/
|   ...
Run Code Online (Sandbox Code Playgroud)

js文件夹包含源文件(与源映射一起使用).我想包含它和.map调试版本的文件,并且在发布版本中只有缩小的js,但我找不到这样做的方法.

到目前为止,我已经尝试过: 

android {
    // this doesn't exclude anything
    packageOptions {
        exclude 'assets/js'
    }
    buildTypes {
        release {
            // this does exclude the js folder, but in both release and debug
            aaptOptions {
                ignoreAssetsPattern "!js"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

任何想法是否有可能实现,如果是,如何?

(我也想过发布两个版本的库(great-libgreat-lib-debug),并且依赖于debugCompilereleaseCompile …

android android-gradle-plugin aar

16
推荐指数
3
解决办法
8581
查看次数

标签 统计

aar ×1

android ×1

android-gradle-plugin ×1