Reputation: 13
This the error message i am getting:
7:42:07 AM: Executing task 'Demo.main()'...
Executing tasks: [Demo.main()] in project C:\Users\shsh\AndroidStudioProjects\Learnjava2
Starting Gradle Daemon... Gradle Daemon started in 8 s 119 ms
FAILURE: Build failed with an exception.
Where: Initialization script 'C:\Users\shsh\AppData\Local\Temp\Demo_main__.gradle' line: 21
What went wrong: A problem occurred configuring project ':app'.
Could not create task ':app:Demo.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.
Get more help at https://help.gradle.org
BUILD FAILED in 35s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings 7:42:44 AM: Task execution finished 'Demo.main()'.
Upvotes: 0
Views: 1106
Reputation: 3765
Ok, I see that it says that the Gradle version is not correct!
To solve it, you first need to go to the Gradle Scripts folder and double-click on the first file which is build.gradle
.There is two build.gradle
so click on the first one.
There in dependencies, you will find one line starting with classpath 'com.android.tools.build:gradle
.
In that line check if you getting any warning. If yes, click on that line, see the starting of the line and you will see one yellow coloured bulb. Click it and click Change to 7.0.3
.
Click it and wait for some time as it will remove the older version and add the new one. This might take from 2 mins to 10 mins.
Hope it helps.🙂
Upvotes: 1