Gradle Peer未经过身份验证的OutOfMemoryError:PermGen空间

时间:2015-08-06 06:21:37

标签: exception android-studio gradle out-of-memory peer

我花了很多时间在Android Studio 1.3上运行项目。我遇到了很多问题所以我想把它们放在一个地方,以便其他人可以从中受益并节省时间。

  • Android对等方未经过身份验证
  • Android Studio Gradle问题:OutOfMemoryError:PermGen space
  • Gradle无法抬头https://..pom> peer未经过身份验证

我会回答所有这些问题

1 个答案:

答案 0 :(得分:0)

Windows 8(64位)上的Android Studio 1.3(64位)

1)安装Java 8(64位)并卸载所有其他,删除旧java的路径

2)转到cmd并键入“java -version”它应该打印1.8版本信息

3)转到Environment Variables并定义两个变量

  • _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
  • JAVA_HOME C:\Program Files\Java\jdk1.8.0_51

4)打开Android Studio(如果有关闭项目)项目默认值 - >项目结构并设置Java和Android路径

Project Structure

5)在您的settings.gradle中仅包含您需要的项目,例如:include ':library-projects/android-az-progressbar', 'az-sample-trunk'

6)如果您有庞大的项目,那么您需要在项目.gradle文件android { dependencies {

下定义这些选项
dexOptions {
        jumboMode true
        incremental true
        preDexLibraries false
        javaMaxHeapSize "4g"
    }

7)现在转到C:\Users\{your_user}\.gradle并制作一个名为“gradle.properties”的新文件

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
# TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

# Enables new incubating mode that makes Gradle selective when configuring projects. 
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

#org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m

8)现在重新启动计算机,如果需要,请从文件菜单中无效缓存/重新启动Android Studio