I started learning Kotlin in Android studio a few days ago and I still haven’t figured it all out, so having this problem is a big question mark for me, I know nothing yet about gradle. Screen of faild gradle
I just created a new empty activity and it suddenly appears out of nowhere.
this is my buildgradle file :
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false}
task clean(type: Delete) {
delete rootProject.buildDir}
7
Answers
So the problem is now solved .... for some reason. I just want to add that I really don't understand why (in case someone wants to help me haha).
I tried to open another project, in another widow and I did exactly the same thing. I created a new empty activity to see if the problem was with my computer or the internet. But it wasn't. Everything worked perfectly well. No gradle problems. So I closed the second project, with the idea of really trying to find an answer for my main project, but suddenly it just... worked. I did NOTHING. I just opened a second project.
I really don't get it.
The same thing happened to me. I just created a new project and the problem is solved.
Android studio will install org.jetbrains.kotlin.android automatically. When you click "sync with Gradle Files" first time, Android studio didn`t react to it. After your second click, it did. that`s all.
I solve this problem by changing my vpn,which make Android studio can connect to google.
below for someone like me in China:
我的解决办法是,Android Studio设置里开代理(socks),这个时候你点“sync with Gradle Files”,会有弹窗,记得勾选HTTPS代理,然后就行了,等它下好就行。
(其实,不要手贱点掉HTTPS代理就不会有问题QAQ)
不勾选HTTPS代理的话,在v2rayN那里会显示rejected。
I was able to fix this by disabling offline mode of gradle and syncing.
Access the below by going to View -> Tool Windows -> Gradle
If button is off, press it twice to disable offline mode
Try using a the latest version, the current latest version is:
Update your plugins to
This problem occurs when there is and older version of the package (org.jetbrains.kotlin.android) so the error denotes for updating the package version .
add the following line to your PROJECT LEVEL GRADLE FILE INTO THE PLUGLINS
NOTE : USE THIS VERSION "1.7.20" INSTEAD OF "1.6.21"