简体   繁体   English

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

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 我刚刚升级到Android Studio 2.2而且我无法再构建我的项目,因为Gradle构建总是因多个java.lang.OutOfMemoryError: unable to create new native thread失败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. 从我的研究来看,这似乎与我的操作系统(OSX El Capitan)有关,而不是与Gradle本身有关。 However, I have attempted several workarounds with no success. 但是,我尝试了几种解决方法但没有成功。

My studio.vmoptions file looks like this: 我的studio.vmoptions文件如下所示:

# 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: ulimit -a给了我以下内容:

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 我目前的JDK是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. 从2.2.0切换回gradle 2.1.3修复了问题。

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

In case someone runs into the same wall I did, you may try disabling Instant Run. 如果有人遇到我所做的同一面墙,你可能会尝试禁用即时运行。 I had to take these steps to build successfully: - upgrade to gradle 2.2.3 when prompted - disable Instant Run in AS preferences - go back to gradle 2.1.3 in build.gradle 我必须采取以下步骤才能成功构建: - 在提示时升级到gradle 2.2.3 - 在AS首选项中禁用Instant Run - 在build.gradle中返回gradle 2.1.3

回到build.gradle文件中的gradle 2.1.3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kubernetes - java.lang.OutOfMemoryError:无法创建新的本机线程 - Kubernetes - java.lang.OutOfMemoryError: unable to create new native thread java.lang.OutOfMemoryError: 遇到无法创建新的本机线程 - java.lang.OutOfMemoryError: unable to create new native thread encountered PlayFramework java.lang.OutOfMemoryError:无法创建新的本地线程 - PlayFramework java.lang.OutOfMemoryError: unable to create new native thread java.lang.OutOfMemoryError无法创建新的本机线程 - java.lang.OutOfMemoryError Unable to create new native thread Java.lang.OutOfMemoryError:无法创建新的本机线程-Linux - Java.lang.OutOfMemoryError: unable to create new native thread -Linux “java.lang.OutOfMemoryError:无法创建新的本地线程” - "java.lang.OutOfMemoryError : unable to create new native Thread" jWebSocket java.lang.OutOfMemoryError:无法创建新的本机线程 - jWebSocket java.lang.OutOfMemoryError: unable to create new native thread java.lang.OutOfMemoryError:无法创建新的本机线程 - java.lang.OutOfMemoryError: unable to create new native thread java.lang.OutOfMemoryError:无法创建新的本机线程 - java.lang.OutOfMemoryError: unable to create new native thread 异常:java.lang.OutOfMemoryError,无法创建新的本机线程 - Exception: java.lang.OutOfMemoryError, unable to create a new native thread
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM