简体   繁体   English

Android-在代码中使用依赖项依赖关系的一种好习惯?

[英]Android - Its a good practice to use dependency dependecies in your code?

If I use Retrofit for example and I need to use OkHttp, then should I include it manually in my dependencies or use the included by Retrofit? 例如,如果我使用Retrofit,而我需要使用OkHttp,那么我应该在依赖项中手动添加它还是使用Retrofit包含的内容?

How can I use the version that I want and avoid Proguard errors? 如何使用所需的版本并避免Proguard错误?

Always use the library that is specified by the other library, unless you have a very good reason for separating them. 除非您有充分的理由将它们分开,否则请始终使用其他库指定的库。 That's how you prevent possible incompatibilities between the two libraries. 这样就可以防止两个库之间可能出现的不兼容性。

If you must use a different version, test thoroughly to make sure you're not introducing a bug. 如果必须使用其他版本,请进行彻底测试以确保未引入错误。

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

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