Android Studio 2.2,Gradle构建失败,java.lang.OutOfMemoryError:无法创建新的本地线程

编程入门 行业动态 更新时间:2024-10-23 01:41:58
本文介绍了Android Studio 2.2,Gradle构建失败,java.lang.OutOfMemoryError:无法创建新的本地线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚刚升级到Android Studio 2.2,因为Gradle构建总是失败,出现多个 java.lang.OutOfMemoryError:无法创建新的本地线程

我的studio.vmoptions文件如下所示:

#定制Android Studio VM选项,请参阅tools.android/tech-docs/configuration -Xms128m -Xmx750m -XX :MaxPermSize = 512m -XX:ReservedCodeCacheSize = 96m -XX:+ UseCompressedOops -XX:+ HeapDumpOnOutOfMemoryError

ulimit -a 给了我以下信息: 核心文件大小(块,-c)0 数据段大小(千字节,-d)无限文件大小(块,-f)无限最大锁定内存(kbytes,-l)无限最大内存大小(千字节,-m)无限制打开文件(-n)256 管道大小(512字节,-p)1 堆栈大小(千字节,-s)8192 cpu时间(秒,-t)无限制最大用户进程(-u)709 虚拟备忘录ry(kbytes,-v)unlimited

我尝试增加我的最大用户进程无济于事。有其他人有这个问题吗?我目前的JDK是1.8.0_102

解决方案

我的项目有同样的问题,在升级之前可以毫无问题地构建。 / p>

从2.2.0切换回gradle 2.1.3修复了这个问题。

buildscript { ... 依赖项{ classpath'com.android.tools.build:gradle:2.1.3'} }

I just upgraded to Android Studio 2.2 and I can no longer build my project because the Gradle build always fails with multiple java.lang.OutOfMemoryError: unable to create new native thread

From my research, it seems this could have more to do with my operating system (OSX El Capitan) than with Gradle itself. However, I have attempted several workarounds with no success.

My studio.vmoptions file looks like this:

# custom Android Studio VM options, see tools.android/tech-docs/configuration -Xms128m -Xmx750m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=96m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError

ulimit -a gives me the following:

core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 256 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 709 virtual memory (kbytes, -v) unlimited

I've tried increasing my max user processes to no avail. Is anyone else having this issue? My current JDK is 1.8.0_102

解决方案

I have the same issue with my project which can be built without problem before upgrading.

Switched back to gradle 2.1.3 from 2.2.0 fixed the problem.

buildscript { ... dependencies { classpath 'com.android.tools.build:gradle:2.1.3' } }

更多推荐

Android Studio 2.2,Gradle构建失败,java.lang.OutOfMemoryError:无法创建新的本地线程

本文发布于:2023-11-25 18:49:09,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:线程   Studio   Android   Gradle   OutOfMemoryError

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!