AndroidStudio常见问题

本文涵盖AndroidStudio中常见的依赖关键字更新、KotlinGradle插件版本调整、模拟器avd位置修改、新建文件注释自动生成及解决INSTALL_FAILED_INVALID_APK错误的方法。通过详细步骤指导,帮助开发者有效应对开发过程中的常见难题。

常见提示

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.

https://stackoverflow.com/questions/42668595/installation-failed-to-finalize-session-signatures-are-inconsistent-android

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值