Android的工作室:排除在资源sourceSets资源文件 [英] Android Studio: Exclude resource file under resources sourceSets

查看:2203
本文介绍了Android的工作室:排除在资源sourceSets资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发采用了android Studio作为IDE一个Android应用程序。

I'm developing an android app using android studio as IDE.

我的问题是:
如何构建APK的过程中排除某些目录下的某些文件?

My question is:
How to exclude certain files under certain directory during the process of building APK?

在我的情况,我想从建立以来,那​​些在我的项目中使用的文件被指定从网络,应用程序下载,而在开发过程中,我希望是指他们在布局排除一些图像。

In my case, I want to exclude some images from building since the those files used in my project are designated to be downloaded from network in-app while during the development I hope to refer them in the layout.

谷歌搜索后,我找到了一些解决方案:
<一href="http://stackoverflow.com/questions/12617827/gradle-1-2-exclude-directory-under-resources-sourcesets">Gradle 1.2:在资源sourceSets排除目录
<一href="http://stackoverflow.com/questions/24721880/how-to-exclude-file-from-resources-using-gradle-and-android-studio">How从使用摇篮和Android Studio的资源排除文件?
而<一href="http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.SourceSet.html#org.gradle.api.tasks.SourceSet:resources">reference从gradle.org

After googling, I found some solutions:
Gradle 1.2: Exclude directory under resources sourceSets
How to exclude file from resources using Gradle and Android Studio?
And reference from gradle.org

然后,我来到了我的解决方案在build.gradle:

Then I came up my solution in build.gradle:

sourceSets {
    main {
        resources.exclude '**/drawable/*'
        res.exclude '**/drawable/*'
    }
}

不过,这是行不通的,在RES图像/绘制/仍显示(下载前)。

But it doesn't work, the image under res/drawable/ still shows up(before downloading).

Android的工作室版本目前0.8.4。
任何想法是AP preciated。

The Android Studio version is currently 0.8.4.
Any idea would be appreciated.

推荐答案

排除路径。你可以在错误<一个跟踪此href="https://$c$c.google.com/p/android/issues/detail?id=64957">https://$c$c.google.com/p/android/issues/detail?id=64957

Exclude paths aren't currently supported for Android sourceSets. You can track this at bug https://code.google.com/p/android/issues/detail?id=64957

这是发生由于Android sourceSets是不一样的Java sourceSets;他们在Android插件自定义实现,而不会自动拿起他们的堂兄弟的所有功能。这将需要专门为机器人实现,并且它尚未完成。

This is happening because Android sourceSets aren't the same as Java sourceSets; they're a custom implementation in the Android plugin, and don't automatically pick up all the features of their cousins. This will need to be specially implemented for Android, and it hasn't been done yet.

这篇关于Android的工作室:排除在资源sourceSets资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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