Android Studio 2.2,Gradle构建失败,java.lang.OutOfMemoryError:无法创建新的本地线程 [英] Android Studio 2.2, Gradle build fails with java.lang.OutOfMemoryError: unable to create new native thread

查看:565
本文介绍了Android Studio 2.2,Gradle构建失败,java.lang.OutOfMemoryError:无法创建新的本地线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

 #定制Android Studio VM选项,请参阅http://tools.android.com/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 http://tools.android.com/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:无法创建新的本地线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆