dave o grady
dave o grady

Reputation: 822

BuildConfig is public, should be declared in a file named BuildConfig.java

Seem to be getting this occurring error whenever I run my android application.

The only way to get around it is by rebuilding the project and runs normally again.

If anyone knows the reason for this will be much appreciated

Upvotes: 12

Views: 8315

Answers (4)

M Jesse
M Jesse

Reputation: 2273

Under your Project view in Android Studio navigate to the .gradle folder.

In that folder, if you see more than one version of gradle, such as, for example, 7.0.2 and 6.1.0.

Delete one of the versions, preferably the lower version.

Clean, build, and you run.

It should run each time without the error, or the necessity to clean and build.

Upvotes: 0

Priyansh jain
Priyansh jain

Reputation: 1422

For Flutter users,

  1. Execute Flutter Clean in terminal of your project folder.
  2. Run flutter pub get to get all packages.
  3. Run your project.

Although, the problem arises everytime I try to run the project. This problems arises after I added a package in my project. So, that package might be causing some problem.

Upvotes: 3

Sunil KV
Sunil KV

Reputation: 763

Faced the same issue when ever tried to install the App,

Build -> Clean Project Then Build -> Make Project

even though problem arises again and again then go with the below steps.

Delete .gradle Folder within android Directory

Now, click Run it works fine.

Upvotes: 6

Allen M.
Allen M.

Reputation: 91

Try Build -> Clean Project Then Build -> Make Project

Upvotes: 9

Related Questions