capellaIDIF
capellaIDIF

Reputation: 13

I am having problems running my first java program on my android studio

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.

Could not create task ':app:Demo.main()'. SourceSet with name 'main' not found.

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

Answers (1)

Sambhav Khandelwal
Sambhav Khandelwal

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

Related Questions