简体   繁体   English

Android Studio新活动模板添加使用Kotlin DSL时已在gradle文件中定义的相同依赖项?

[英]Android studio new activity template add same dependencies already defined in gradle file when use Kotlin DSL?

When I use new empty activity template android studio it auto adds two line dependencies in my app build.gradle.kts and resync the project. 当我使用新的空活动模板android studio时,它会在我的应用程序build.gradle.kts中自动添加两个行依赖项,然后重新同步该项目。

implementation(Config.Libs.appCompat)
implementation(Config.Libs.constraintLayout)

implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'

Seems like android studio cannot detect defined dependencies when use with Kotlin DSL. 似乎android studio与Kotlin DSL搭配使用时无法检测到已定义的依赖项。 Anyone know how to slove this? 有人知道该怎么做吗?

Yes, now you should manually remove unnecessary dependencies from your .gradle files, moreover you store your project dependencies in support files outside the .gradle files so the Android Studio's system cannot recognize the fact that dependencies have already added in the project. 是的,现在您应该手动从.gradle文件中删除不必要的依赖项,此外,您将项目依赖项存储在.gradle文件之外的支持文件中,以便Android Studio的系统无法识别依赖项已添加到项目中的事实。

Maybe in future it'll be added in IDE but now you should manage your dependencies' files by yourself. 也许将来会添加到IDE中,但是现在您应该自己管理依赖项的文件。

Happy coding! 编码愉快!

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

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