android studio exclude,记录Android-Studio遇到的各种坑

开此文章,主要是为了记录在使用虐我千百遍,我还待他如初恋的AS的过程中所遇到的各种坑,一来是希望做个记录,方便查找,防止再次踏入同样的坑;二来也希望能帮助到有遇到有跟我相同问题的人。

1,首先每次导入一个新的AS工程的时候,肯定会有各种gradle配置问题,只要把build.gradle改为与自己系统相匹配即可,如果报

Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "f3cec24ce64772515843ff5f88a0005c31cdbe71"

把project的build.gradle里面的2.0.0-alpha3改为 1.5.0 即可

E:\android-studio-2.0-preview4\android-studio\gradle\m2repository\com\android\tools\build\gradle

这个目录下面有当前安装的版本,都可以试试

再把其他build.gradle里面的 compileSdkVersion 和  buildToolsVersion  和  依赖的support包版本改为自己常用的版本一般就可正常调试了。

2,如果在下载程序的时候,报了以下错误

Error:Could not create the Java Virtual Machine. Invalid maximum heap size:4g

这个错误我找了很久,最后还是在万能的stackoverflow里找到了答案,其实就是项目的build.gradle被配置了

dexOptions {

incremental true

javaMaxHeapSize "4g"

}

把4g 改为1024m问题解决

3,快速将一个项目转换为lib项目:

①   修改build.gradle,把  applyplugin:'com.android.application'改为applyplugin:'com.android.library'

然后去掉 defaultConfig里面的applicationId

②   清空AndroidManifest里面的内容留下最外层manifest即可,如下:

package="***">

4,AS项目的包名是在build.gradle文件里面的applicationId配置的,在mainfest配置将不生效。

5,eclipse项目转为android studio : 在eclipse中Export,导出gradle项目,选择需要导出的项目及libProject,随便找个正常的as工程的gradle文件夹,覆盖刚刚导出项目的gradle文件夹,然后根据 1 进行配置即可。(注:导出的项目会覆盖原工程使得此项目可以同时在eclipse和android studio中使用,as比ec检测严格,会检测到所有重复的资源,权限,假冒的.9,jar,以及中文乱码,根据对应提示进行删除)

6,大坑:

Warning:Ignoring InnerClasses attribute for an anonymous inner class

(com.tencent.mm.sdk.b.b) that doesn't come with an

associated EnclosingMethod attribute. This class was probably produced by a

compiler that did not target the modern .class file format. The recommended

solution is to recompile the class from source, using an up-to-date compiler

and without specifying any "-target" type options. The consequence of ignoring

this warning is that reflective operations on this class will incorrectly

indicate that it is *not* an inner class.

Warning:Ignoring InnerClasses attribute for an anonymous inner class

(com.tencent.mm.sdk.openapi.WXApiImplV10$ActivityLifecycleCb$2) that doesn't come with an<

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值