在Android的Studio和摇篮使用不同的构建类型库模块的Andr​​oid应用程序模块 [英] Use different build types of Library Module in Android App Module in Android Studio and Gradle

查看:163
本文介绍了在Android的Studio和摇篮使用不同的构建类型库模块的Andr​​oid应用程序模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含几个不同的应用程序工作区和我期待转换的Eclipse到Android Studio和从蚂蚁到摇篮公用库项目。目前,在我们的Ant脚本,我们取决于该版本是用于调试,质量保证,测试/客户验收测试或意味着释放,谷歌播放编译前在我们的一些类替换文本。

I have a workspace containing several different apps and a common library project that I am looking to convert from Eclipse to Android Studio and from Ant to Gradle. Currently, in our ant scripts we replace text in a few of our classes before compiling depending on if the build is for debug purposes, QA, Beta/Customer Acceptance testing or meant for release to Google Play.

我想利用构建变量系统的摇篮和使用价值资源(布尔值,字符串等),以从具有构建脚本在我的课替换文本保留。

I want to take advantage of the build variant system in Gradle and use value resources (booleans, strings, etc) to keep from having the build script replace text in my classes.

由于复制不同的值都在我所有的应用程序产品的构建类型将是一个头疼的维护,我希望把他们在构建类型在我的公共库。我试过,但无论哪个建立我在我的应用程序模块使用的类型,应用程序模块中的公共库模块的发布版本拉。

Since duplicating the different values for all of the build types in all of my app products would be a maintenance headache, I want to put them in the build types in my common library. I tried this but no matter which build type I use in my app modules, the app module pulls in the Release build of the common library module.

有什么办法,我可以得到不同的构建类型应用程序模块使用的库模块的相应版本类型?

Is there any way that I can get the different build types of the app modules to use the corresponding build type of the library module?

这是从Android的一室公寓同时显示模块,使用调试版本生成变种工具窗口中运行。图像应读为应用程序和库调试。

This was run from Android Studio with the Build Variants tool window showing both modules as using the debug variant. The image should read debug for both app and library.

推荐答案

好了,摇篮Android插件根本无法构建调试版本的依赖库模块。这是一个知名,老问题和这是尚未解决。结果
您可以尝试使用一些变通办法从我提到的讨论,特别是看看帖子#35和#38。

Well, Gradle Android plugin simply can't build the debug version of dependent library modules. This is a well-known, old issue and this is not resolved yet.
You can try to use some workarounds from the discussion I mentioned, specifically take a look at posts #35 and #38.

这篇关于在Android的Studio和摇篮使用不同的构建类型库模块的Andr​​oid应用程序模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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