问题描述:

同事给了一个项目让我运行,我打开工程后,本地使用的gradle 3.3版本和com.android.tools.builld:gradle:2.3.2版本都要高于项目本身指定的gradle 2.14.1和2.2.3,使用本地自己的版本没有去下载项目原来指定的版本,build项目没有问题,运行项目,发现运行时间很久,半天都没动静,运行结束发现报错了。

错误如下:

1.Warning:warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.tencent.mm.sdk.openapi) 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.

大量的这种警告,大概意思就是使用的jar版本太老,需要使用新版本,

不过这个是警告,你不去处理也不会影响项目运行,所以虽然很多,但是别慌,可以不用理他。

2.Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class……

这个错误才是项目运行不起来的真正原因,其实也很简单解决,第一行是不是看不懂?但是没关系我看得懂第二行,GC了,所以从看得懂的地方入手,先解决GC,打开你项目中的gradle.properties文件,在文件里增加一行

org.gradle.jvmargs=-Xmx2048m

这个配置就好了,系统默认的大小是1024,我们增大就行了。

备注:其实最简单的方法还是去下载项目指定的gradle版本和com.android.tools.builld:gradle版本,这样基本都不会出现什么问题,但是谁让我们可能网不好呢,唉。

Android Studio导入项目运行出现大量警告,且报错GC,解决办法相关推荐

  1. Android Studio 导入项目运行按钮灰色的完美解决方法

    今天导入项目的时候突然发现编译后运行按钮为灰色. 解决方案: 第一步:点击图中的Add Configuration,出来如下界面 在这里插入图片描述 第二步:点+号,并选择Android App选项 ...

  2. Android Studio 导入项目时出现Failed to apply plugin

    Android Studio导入项目时出现问题 Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Faile ...

  3. Android Studio导入项目app module一直不显示

    Android Studio导入项目app module一直不显示 问题描述及尝试解决 Android Studio版本:3.5.2 导入或打开已有Android项目时Gradle插件版本和Gradl ...

  4. IDEA中导入项目运行失败提示Illeagle Arguement,访问404解决方法(Idea的Modules设置)

    文章目录 IDEA中导入项目运行失败提示Illeagle Arguement,访问404解决方法(Idea的Modules设置) 起因 尝试1:设置resources文件 尝试2:啃代码 尝试3:完全 ...

  5. Android Studio之debug调试卡在waiting for debugger界面的解决办法

    1.问题 Android Studio debug调试项目卡在waiting for debugger界面 2.解决办法 一开始从启adb服务 adb stop-server adb start-se ...

  6. 图解Myeclipse 导入Java Web项目报错的解决办法听语音

    图解Myeclipse 导入Java Web项目报错的解决办法听语音 https://jingyan.baidu.com/article/046a7b3e953ef3f9c27fa93d.html

  7. Android Studio 数据库可视化工具(Database Inspector)报错

    Android Studio 数据库可视化工具(Database Inspector)报错 使用这个工具的时候报了错 ,(诸位还有可能是好奇点了一下),然后,就报错了 提示如下: Database I ...

  8. 【DSP】CCS6.1导入CCS3.3工程全过程以及“N个报错”的解决办法

    本人小硕,由于接到了一个关于语音识别的项目,一不小心掉到DSP的坑.首先需要解决的就是关于CCS软件的使用,网上N个教程,总感觉自己这边出的问题总能"完美避开"他们的范围,摸爬滚打 ...

  9. Xamarin开发安装Visual Studio 2015 update2报错的解决办法

    Xamarin开发安装Visual Studio 2015 update2报错的解决办法 错误信息:update 2 requires a member of the visual studio 20 ...

  10. android线程改变布局,Android线程中设置控件的值提示报错的解决方法

    本文实例讲述了Android线程中设置控件的值提示报错的解决方法.分享给大家供大家参考,具体如下: 在Android线程中设置控件的值一般会与Handler联合使用,如下: package com.y ...

最新文章

  1. LeetCode 159. Longest Substring with At Most Two Distinct Characters --Java,C++,Python解法
  2. Red Hat Linux 挂载外部资源
  3. apache 域名跳转
  4. Spring Cloud:使用Ribbon实现负载均衡详解(下)
  5. [SecureCRT]通过SFTP方式上传本地文件到服务器
  6. UDP打洞程序包的源码
  7. Linux(Centos7)下安装Redis(redis-5.0.8)
  8. android textview获取背景颜色,android – 从textview获取背景颜色而不使用ColorDrawable(API 11)...
  9. php 查询和redis,php如何查询redis
  10. HMM一文搞懂HMM(隐马尔可夫模型)
  11. python写机器人程序_从Python写入机器人框架控制台
  12. clinit和init(转载)
  13. 如何帮助空降经理人成功?
  14. 当独孤求败遇见东方不败
  15. 2022 年牛客多校第五场补题记录
  16. 电商业务Alipay支付实战(当面付实现)
  17. vc禁止标题栏拖动窗口
  18. lisp调用qleader端点_常用函数.lsp - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...
  19. pat乙级 1006 题解
  20. Swift 第三方库整理

热门文章

  1. redis事务冲突问题 - 乐观锁和悲观锁
  2. Mybatis 延迟加载策略
  3. linux 3.2.0 卸载,linux python3编译以及 卸载,python默认为python3 ,pip默认为pip3,亲测版...
  4. 一招判断三元催化堵塞_三元催化堵塞,许多老司机不知道如何处理,教你一妙招,油耗低...
  5. python微信群定时发送消息_Python3 itchat实现微信定时发送群消息的实例代码
  6. Go基础:函数与方法的区别
  7. 实战Node—幼教平台项目重构和优化
  8. Pannellum:详解利用Pannellum实现Web三维全景功能
  9. HTML5重要知识点整理
  10. 深度学习笔记_搭建一个简单网络(完整版)_手写数字识别MNIST