AS填坑

1,

Gradle project sync failed.Please fix project and try again.

2,

Observed package id 'add-ons;addon-google_apis-google-23' in 
inconsistent location 'D:\LocalSDK\AndroidStudio\sdk\add-ons\addon-google_apis-google-23-1' (Expected 'D:\LocalSDK\AndroidStudio\sdk\add-ons\addon-google_apis-google-23')

23版本的有两个,直接删除D:\LocalSDK\AndroidStudio\sdk\add-ons\文件夹下的一个就行,留一个。问题解决!
3,

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/yanzhenjie/nohttp/BuildConfig;
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'' finished with non-zero exit value 2

可以查看发现在.idea/libraries中发现两个不同版本的nohttp的jar包。
所以,解决问题也就很简单,想办法去掉一个就行。我是这样干的,先重新选定一个版本进行编译。如何再clean掉,最后再运行。问题解决
4,

com.android.ddmlib.AdbCommandRejectedException: device offline
Error while Installing APK

网上有说重启adb。执行命令adb kill-server; adb start-server。
我试过无效。最后是重启电脑才好了。
5,
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.apache.commons.logging.LogFactory$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

这里写图片描述

在该项目里的proguard-rules.pro 中加入下面这句代码即可:

-keepattributes EnclosingMethod

问题解决
之后问题又出现了,这个问题还会导致无法打包
解决办法是,在开发的项目build.gradle中添加

defaultConfig {
        multiDexEnabled true
   }
   dependencies { compile 'com.android.support:multidex:1.0.1' }

之后再打包,可以成功,问题解决
5,
Android Studio更新到2.0以后,在build variants窗口下没有 test artifact选项,无法选择是Android Instrumentation Tests还是Unit Tests
Google一下,解决方案是依次打开: File Menu -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Experimental,

将Enable all test artifacts (Unit Test and Instrumentation Test) in Android projects取消勾选,之后我们熟悉的Test Artifact就出现了,如下图
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值