简体   繁体   English

Android Studio Gradle依赖性检查

[英]Android Studio Gradle Dependency Check

I am trying to develop a Google Play Services like structure which is split into its own separate components (libraries) that can be added to Android Studio as dependencies. 我正在尝试开发类似Google Play Services的结构,该结构被拆分成自己的独立组件(库),可以作为依赖项添加到Android Studio中。 For example what is displayed below; 例如,下面显示的内容;

在此处输入图片说明

Like the Play Services libraries I would like to force the user to use the same version for all the libraries when adding more than one, as seen below; 就像Play服务库一样,我想强迫用户在添加多个库时对所有库使用相同版本,如下所示;

在此处输入图片说明

I am wondering how the build.gradle file determines this? 我想知道build.gradle文件如何确定这一点? Is it built into Android Studio, is it coming from the build tools plugin? 它内置于Android Studio中吗,它是否来自构建工具插件?

As I would like to do something like this, if anyone has any helpful suggestions/links it would much appreciated. 我想做这样的事情,如果有人有任何有用的建议/链接,将不胜感激。

You can use Lint to define custom rules based on your needs. 您可以使用Lint根据需要定义自定义规则。 There is a really good explanation on topic with an example on Android Studio Project Site . Android Studio Project网站上有一个关于主题的很好的解释。


An easy way to start defining your own Lint rules is by modifying the sample project provided at this link http://tools.android.com/tips/lint-custom-rules/customlint.zip?attredirects=0&d=1 开始定义自己的Lint规则的一种简单方法是修改此链接http://tools.android.com/tips/lint-custom-rules/customlint.zip?attredirects=0&d=1提供的示例项目
This way you will have all the dependencies set up to use the Lint APIs. 这样,您将设置所有依赖项以使用Lint API。

Source http://tools.android.com/tips/lint-custom-rules 来源http://tools.android.com/tips/lint-custom-rules

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM