AndroidStudio常见问题
常见提示
1.依赖关键字
Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
配置’compile’已经过时,已被’implementation’和’api’取代。
它将在2018年底删除。有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html
2.Kotlin Gradle plugin 插件版本号
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project ‘followingCar’ is using version 1.2.50.
修改工程文件中的build.gradle文件(不是model中的build.gradle),ext.kotlin_version = '1.2.50’为:ext.kotlin_version = ‘1.2.51’,并且Sync now 或者 restarted Android Studio
3.修改AndroidStudio模拟器avd的位置
win10上面默认的位置是:C:\Users\admin.android,在c盘会占用很大的空间。通过以下方法可以修改这个默认位置:
1):在e盘建立一个AndroidAVD的文件夹
2):新建一个环境变量:ANDROID_SDK_HOME,将其变量值设置为:e:/AndroidAVD,然后重启电脑。
3):新建的模拟器就会出现在e:/AndroidAVD文件夹中
4.新建文件时自动添加注释
File—>Settings—>File and Code Templates,在Includes选项卡里面,点击File Header,将这个文件的内容设置为以下内容:
/**
* ProjectName:${PROJECT_NAME}
* DESC: (类描述)
* Created by ${USER} ${DATE}
* updateName:(修改人名称)
* updateTime:(修改时间)${TIME}
* updateDesc:(修改内容)
*/
以后新建文件时会自动创建一段注释
5.INSTALL_FAILED_INVALID_APK运行AndroidStudio模拟器出现错误
Installation failed with message Failed to finalize session : INSTALL_FAILED_INVALID_APK: Split lib_slice_7_apk was defined multiple times.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
This error usually happens to me in Android Studio when I try to open a project that was moved from another path or location, also other circumstances might cause this, what works for me is:
- menu “Build”
- run “Rebuild Project”
Then run app on device or emulator, and error goes away. I know the error has nothing to do with this but that’s what fixes it for me, try and let me know.
本文涵盖AndroidStudio中常见的依赖关键字更新、KotlinGradle插件版本调整、模拟器avd位置修改、新建文件注释自动生成及解决INSTALL_FAILED_INVALID_APK错误的方法。通过详细步骤指导,帮助开发者有效应对开发过程中的常见难题。
1446

被折叠的 条评论
为什么被折叠?



