0

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

  • Android 对等体未通过身份验证
  • Android Studio Gradle 问题:OutOfMemoryError: PermGen space
  • Gradle 无法 HEAD https://..pom > peer 未通过身份验证

我会回答所有这些问题

4

1 回答 1

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 (如果有的话关闭项目) Project Defaults -> Project Structure 并设置 Java 和 Android Path

项目结构

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 工作室

于 2015-08-06T06:21:37.177 回答