Program type already present: BuildConfig

徘徊边缘 提交于 2019-11-29 01:07:18

You are getting this error because you a have library module which has the same package name as the app module.

The solution would be to change package name of your library module. You can follow the accepted answer in this SO which describes how to change the package name in android studio.

Error: Program type already present: somemodule/BuildConfig

Cause

In my case I had a (hidden) circular dependency which Android Studio did not find:

  1. testutils/build.gradle uses implementation project(':somemodule')

  2. somemodule/build.gradle had `androidTestImplementation project(":testutils")

Solution

  • in my case the second dependency was not neccessary so I removed it

In my case It was happening when I try to run older project on new installed Android studio The problem solved by running Build->Clean Project

You can see this response https://stackoverflow.com/a/26531074/4097495 in my case solve with this suggestion. my app and my module have same package name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!