您当前的位置: 首页 >  灵境引路人

【安卓APP】从零开始的安卓桌面小应用(问题合集篇)

灵境引路人 发布时间:2020-11-20 16:26:56 ,浏览量:3

本篇主要描述创建一个空白模板遇到的各种问题

1.由于AS(Android Studio)版本有点低,有些东西和网上教程不太符合,建议动手先安装最新版本。 在这里插入图片描述在这里插入图片描述

在这里插入图片描述

先选一个最简单的 在这里插入图片描述在这里插入图片描述

遇到以下报错内容: Call requires API level 3 (current min is 1) Call requires API level 4 (current min is 1) 解决方法: (1)由于javaSDK版本很低,用的是1.8.0版本,因此很多功能不兼容,下一个最新的15.0版本就可以了。 (2)有高版本sdk需要配置一下。 在这里插入图片描述在这里插入图片描述 3. 遇到以下报错内容: Error:Could not run build action using Gradle distribution 解决方案: 因为没有配置gradle路径会报错,需要把路径改到本地: 在这里插入图片描述 参考文章:https://blog.csdn.net/qq_28316949/article/details/80522908

4.由于国内下载国外依赖容易出问题,在引入远程依赖包的时候,会出现一个sync fialed的错误。可能出现以下报错内容: …HttpRequestException: Could not GET 'https://… …HttpRequestException: Could not HEAD 'https://… 在这里插入图片描述 解决方案主要有: (1)需要更改依赖下载路径,有不同的改法,以下是成功案例。

        maven{ url 'https://mirrors.huaweicloud.com/repository/maven/' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        // google()
        // jcenter()

在这里插入图片描述 注意 没翻墙一定要吧google注释掉不然一定会报错。 参考文章:https://blog.csdn.net/GerryRun/article/details/92070059(华为仓库)

其他参考: 参考文章1:https://www.jianshu.com/p/e8bc7e79c9f9 参考文章2:https://blog.csdn.net/fan767302856/article/details/83551527 参考文章3:https://blog.csdn.net/weixin_42696192/article/details/102527751 参考文章4:https://blog.csdn.net/u012926088/article/details/82879137 参考文章5:https://blog.csdn.net/yaochangliang159/article/details/72799612 (2)取消代理 在这里插入图片描述 参考文章1:https://blog.csdn.net/liangfeng89/article/details/80535875 参考文章2:https://blog.csdn.net/weixin_42587267/article/details/104271113 (3)检查防火墙 参考文章:https://blog.csdn.net/cui130/article/details/80076578 5. 遇到问题:can not resolve symbol xx.

哪里报错,就根据内容添加对应依赖,通过project structure进去设置,添加依赖。 在这里插入图片描述在这里插入图片描述在这里插入图片描述 6. 遇到问题moudle not specified。无法进行真机调试。 在这里插入图片描述

解决方案: (1)很可能是需要重新Sync Project With Gradle Files 在这里插入图片描述 (2)如果还不行就重新启动Android Studio 参考文档:https://www.jianshu.com/p/c9464207d3ef 解决后会弹出默认的应用,不需要另外创建(当然如果喜欢模拟器+真机分开调试另说)

在这里插入图片描述在这里插入图片描述在这里插入图片描述 7. xml文件中出现“uri is not registered” 参考文章: https://blog.csdn.net/u013806366/article/details/80353358 其实不需要,只要依赖不出错基本上不会有这个问题 8. 出现 attribute:xxx is not allowed here

参考文章: https://www.pianshen.com/article/84841042549/ https://blog.csdn.net/u013909053/article/details/101626021 其实不需要,只要依赖不出错基本上不会有这个问题 9. 报错xml tag has empty body 解决方案: 原


改为


参考文章:https://blog.csdn.net/qq_17009881/article/details/78002987

resource xml/file_paths (aka com.example.rfidretrofit:xml/file_paths) not found.

参考文章:https://blog.csdn.net/qq_35366269/article/details/89239440 需要改为28级API

对应的,buildToolsVersion也需要升级到28以后

拓展资料:compileSdkVersion, minSdkVersion 和 targetSdkVersion https://blog.csdn.net/weixin_40611659/article/details/109120784 踩坑记录,app和base长的很像不能弄混

关注
打赏
1688896170
查看更多评论

灵境引路人

暂无认证

  • 3浏览

    0关注

    28博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0458s