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.
I think you will need to update gradle, in my case I was using JDK 13 and Gradle 5.xx doesn't support it, so upgrading to 6.0.1 resolved the issue for me.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.