If android studio cannot run project, in most cases,it is the gradle question. Because it cannot build the project successfully for you. So we should fix our gradle first. Here are some tips:
1.Check if the gradle is OK for you.
you can click the gradle button,it is always shown on the sidebar. It will show a window box in which there are many gradle plugins,something like the following picture:
The gradle is not OK,if the window box is empty.
2.Check if the version of gradle plugin corresponds to the gradle which you download.
If the gradle is not OK,you should do this step!
For example:
if the version of the plugin is 4.1.1 in build.gradle
of project level:
...
dependencies{
classpath 'com.android.tools.build:gradle:4.1.1'
}
- 1
- 2
- 3
- 4
So the configuration in gradle-wrapper.properties
should be like this:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
- 1
- 2
- 3
- 4
- 5
It’s better to make sure everything is OK with the configuration,before you try another way to solve your problem.
文章来源: blog.csdn.net,作者:WongKyunban,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/weixin_40763897/article/details/114436234