Android常见编译问题总结

一、Grale配置问题

1、Unknown host 'downloads.gradle-dn.com'. You may need to adjust the proxy settings in Gradle.

解决方案:将distributionUrlgai修改为阿里的镜像的url(注释画红线的)

distributionUrl=https\://mirrors.aliyun.com/macports/distfiles/gradle/gradle-6.5-all.zip

2、Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

Unsupported Java.
Your build is currently configured to use Java 17.0.7 and Gradle 6.5.
解决方案:下载低版本的jdk,然后配置对应路径

3、Failed to find Platform SDK with path: platforms;android-30

Could not find compile target android-30 for modules :app, :bottomnavigation

解决方案:将画线的两个文件里面的 compileSdkVersion 改成自己下载的Android Sdk版本

image.png

4、Failed to find Build Tools revision 30.0.43

解决方案:修改为正确的版本 我自己测试可用的“30.0.3”

5、The specified Gradle installation directory

解决方案:打开顶部菜单:File -> Setting -> Build,Execution,Deployment -> BuildTools -> Gradle
找到Gradle projects 下面的Gradle -> Use Gradle from -> 下来选择修改为:'gradle-wrapper.properties' file

6、错误: 程序包android.content不存在 import android.content.Context;

解决方案:去掉图中画线的配置


二、Android Studio配置问题

1、Missing system image on device Pixel 7 Pro API 30


原因:误删除了模拟器的文件,点击重新下载即可


image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容