AndroidStudio常见问题

AndroidStudio常见问题:

  1. Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
    Possible causes for this unexpected error include:

    In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

    这里写图片描述

    系统提示有两种解决问题的方式,我的情况下两种方法都是不可行的。后来发现是因为Gradle版本与当前AndroidStudio使用的版本不一致导致的。

  2. Error:The SDK Build Tools revision (24.0.0) is too low for project ‘:app’. Minimum required is 25.0.0
    Update Build Tools version and sync project
    Open File
    这里写图片描述
    Error:The SDK Build Tools revision (24.0.2) is too low for project ‘:photoedit’. Minimum required is 25.0.0
    Update Build Tools version and sync project
    Open File
    这里写图片描述

    这两种问题性质是一样的,都有两种解决方法。第一种:修改版本号为25.0.0;第二种:点击 Update Build Tools version and sync project直接更新

  3. 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)
    这里写图片描述
    这种问题也是比较常见的,而且点击下载时通常是解决不了问题的。
    解决方式:
    (1)在工程目录下找到gradle文件夹下的gradle-wrapper.properties文件
    这里写图片描述

    (2) 修改distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip的版本号(比如3.3),具体修改成什么版本,参照自己其他的项目
    这里写图片描述
  4. compile、implementation 、 api三者的区别:
    (1).之前在使用AndroidStudio引用外部库的时候,我们通常会使用compile fileTree(include: [‘.jar’], dir: ‘libs’),但是在AndroidStudio升级到3.0版本的时候,又新增了两个引用方式implementation fileTree(dir: ‘libs’, include: [‘.jar’])和api fileTree(include: [‘*.jar’], dir: ‘libs’),而compile 则变成了一个过时的方法。
    (2).其实implementation 和api是将引用的功能进行细化,比如A、B两个module,B是A的依赖库,B中使用implementation 方法依赖glide库,那么如果在A中使用glide库的话需要重新引用;如果B使用的是api方法引用glide库,那么A可以直接使用glide,
    (3).我感觉implementation 相当于类中的private;api相当于类中的public,和compile功能相同。
    这里写图片描述

    5.
Error:Unsupported method: BaseConfig.getApplicationIdSuffix().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

这里写图片描述

解决方式:
 (1)将project中的的build.gradle文件中的 classpath ‘com.android.tools.build:gradle:2.1.2’版本参照你的其他项目修改成可用的版本,重新编译完成

6.使用Androidstudio自带的模拟器时,出现“/dev/kvm not found ”错误,需要在https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager下载最新插件,安装之后重启Androidstudio就可以了
7.Androidstudio添加的svn提交信息中文乱码,可以按照图示方式设置一种可以兼容中文的字体,修改过字体之后,代码区域的字体也会改变
这里写图片描述
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值