3

I'm trying to do a console app in android studio, but when i execute the app it produces an error.

FAILURE: Build failed with an exception.

  • Where: Initialization script /private/var/folders/3g/2b70v24d5cqggs_c_tmts3pw0000gn/T/MainApplication_main__.gradle' line: 20

  • What went wrong: A problem occurred configuring project :app Could not create task ':app:MainApplication.main()'.SourceSet with name 'main' not found.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Kalana
  • 5,631
  • 7
  • 30
  • 51

2 Answers2

1

I think you will need to update gradle, in my case I was using JDK 13 and Gradle 5.x.x doesn't support it, so upgrading to 6.0.1 resolved the issue for me.

rikongha
  • 309
  • 2
  • 8
0

Probably it's using cache files coming with a different gradle version.

Usually the default gradle folder is {user_home}/.gradle

You should delete the content in that folder or specify another folder with the option --project-cache-dir

./gradlew --project-cache-dir .customGradleFolder
AGi
  • 23
  • 5