• 【Android开发】学习笔记(一)



    小学期学校要求完成安卓课程设计,上课讲部分理论,下了课组队完成项目。众所众知,实际开发还是要靠自学么。本系列开始记录线下学习心得、项目完成过程中踩的坑及解决方案等。

    Android Studio快捷键的使用(参见引导tips)

    熟能生巧
    和IDEA的使用确实有点像

    • ctrl+N新建类
    • ctrl+shift+N打开类
    • Ctrl+Shift+空格:显示自动补全的提示选项
    • ctrl+空格: 补全自动提示出现的第一个内容
    • alt+f7 找到某字段在所有代码中出现的位置
    • ctrl+Q 查看对应的文档
    • ctrl+B 跳转到类/方法等定义的位置,也可以ctrl+鼠标点击
    • shift+F6:重命名
    • Ctrl+O:override
    • Ctrl+I:implement
    • alt+insert:generate
    • alt+f1:快速选择(定位到)元素
      剩下的(因为还没用到,怕理解有误,摘录一下原文)
    • You can quickly navigate in the currently edited file with Ctrl+F12
      It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key.
      To easily locate an item in the list, just start typing its name.
    • The Esc key in any tool window moves the focus to the editor.
    • Shift+Esc moves the focus to the editor and also hides the current (or last active) tool window.
    • The F12 key moves the focus from the editor to the last focused tool window.

    解决创建项目的第一个报错

    ERROR: Failed to open zip file.
    Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
    Re-download dependencies and sync project (requires network)
    Re-download dependencies and sync project (requires network)

    解决思路

    由提示可推测:由于网络原因导致下载的gradle包有缺陷。

    解决方案

    如图所示:
    在这里插入图片描述
    选择Project,查看对应的gradle版本信息。
    然后去gradle官网,重新下载这个包。

    下载好了之后进入原包的路径
    比如c:user\你的用户名.gradle\wrapper\dists,用新的压缩包替换掉原来的。

    像我因为原本下载了较低版本的SDK和gradle,我已经找不到完全对应的gradle版本了,我就在替换之后修改了下面这个文件的内容:
    在这里插入图片描述
    将文件中的有网址的那一栏的那个压缩名换成刚刚去官网新下的名字。

    后续

    就这样之后还是会报错,大意是:我最新下好的gradle无法build之类的。

    新问题解决方案

    在这里插入图片描述

    点击这个选项,让系统帮你去掉一些没用的东西,之候软件自动重启,重启好后我的还提示有SDK部分内容缺失,需要下载之类的,只要保持网络畅通,按照提示做就行了。

    至此,问题就解决了。

  • 相关阅读:
    市面上有哪些好用的供应商管理系统?
    论文速览 | IEEE Signal Processing Letters, 2024 | 基于时空上下文学习的事件相机立体深度估计
    Kafka消息可视化工具-Offset Explorer使用
    零基础教程:Yolov5模型改进-添加13种注意力机制
    如何正确的写出第一个java程序:hello java
    kingbase 创建用户报错
    k8s day05
    数据分析技能点-数据挖掘及入门
    Codeforces Round #474 (Div. 1 + Div. 2) - C, F
    Taurus.MVC WebMVC 入门开发教程6:路由配置与路由映射
  • 原文地址:https://blog.csdn.net/julia_xueli/article/details/125479934