一、报错
# 连接不上dl.google.com
# 项目使用的Gradle版本与配置的Gradle版本不一致
请参考:
# Android Studio启动一直卡在启动界面
(1)随便找了一个项目然后用AS打开,打开的瞬间按取消然后就能进到正常界面,
(2)项目不是需要先打开AS,才能选择项目打开吗?现在是打不开AS,可以随便拖一个文件在as的图标上打开 再关闭as 重新启动就好了;
# unable to access android sdk add-on list解决方案
参考:unable to access android sdk add-on list解决方案_Cola可洛的博客-CSDN博客
# Error:Connection timed out: connect
参考(以Kotlin项目为例):【已解决】Error:Connection timed out: connect_游逸的博客-CSDN博客
# Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager.
解决方法:
进入SDK目录/build-tools/32.0.0,讲d8改为dx,进入/build-tools/32.0.0/lib,将d8.jar改为dx.jar,重启,解决
# INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
完整报错:
Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
原因:
这个错误主要是androidManifest.xml中有写法错误之类的问题
更安全的组件导出:如果您的应用以 Android 12 为目标平台,且包含使用 intent 过滤器的 activity、服务或广播接收器,您必须为这些应用组件显式声明 android:exported 属性。
警告:如果 activity、服务或广播接收器使用 intent 过滤器,并且未显式声明 android:exported 的值,则您的应用将无法在搭载 Android 12 的设备上进行安装。
解决方案示例,添加android:exported属性:
<service android:name="com.example.app.backgroundService" android:exported="true">
<intent-filter>
<action android:name="com.example.app.START_BACKGROUND" />
</intent-filter>
</service>
# Gradle sync failed: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/g
参考:Gradle sync failed_北荒的博客-CSDN博客
参考: AS配置阿里云镜像地址,加速依赖资源下载_蓝不蓝编程
# Android Studio无法识别手机设备
参考: Ubuntu下 AndroidStudio 无法识别设备的问题_weixin_34138377的博客-CSDN博客
# Gradle报错:Using insecure protocols with repositories,without explicit opt-in,,is unsupported.
# Unrecognized Android Studio (or Android Support plugin for IntelliJ IDEA) version
参考:解决报错 Unrecognized Android Studio (or Android Support plugin for IntelliJ IDEA) version - 简书
三、其它
Android Log使用
https://blog.csdn.net/u010356768/article/details/79049172(这是一个csdn博主的文章、里面还有丰富的Android开发学习内容)
设置自动导入包
参考:新建的Android里没有R文件和设置自动导入包 - 易朵小花 - 博客园
生成apk
参考:Android Studio打包生成APK教程_wwf1225的博客-CSDN博客
Android Studio快捷键
Android Studio查找功能快捷键:
https://blog.csdn.net/wo0123456789wo/article/details/80802089
Android studio快捷键:
https://www.cnblogs.com/0616--ataozhijia/p/3870064.html
我的博客:Android Studio常用快捷键_DreamWendy-CSDN博客
在当前类中查找内容(函数、变量等)
快捷键:Ctrl+F
在当前项目中查找类
快捷键:ctrl+N
Plant UML
简介
Plant UML是Android Studio中用于绘制用例图的一个插件
安装与使用
安装:找到File --> Setting --> Plugins ,搜索Plant UML进行安装;
查看之前绘制的的用例图:将项目模式其切换到Open Files模式,用例图就在app目录下;
PlantUML时序图
参考:plantuml 之序列图(二)_ding_yingzi的博客-CSDN博客
build时间过长
自己的博客: https://blog.csdn.net/qq_41739313/article/details/121460709
Android内存泄露分析
参考:Android 内存泄漏检测之Profiler_Leo_Liang_jie的博客
CPU: https://developer.android.google.cn/studio/profile/cpu-profiler.html
Memory: https://developer.android.google.cn/studio/profile/memory-profiler.html
Network: https://developer.android.google.cn/studio/profile/network-profiler.html
Energy: https://developer.android.google.cn/studio/profile/energy-profiler