Android开发Android开发经验谈Android技术知识

Android命令行下打包步骤+错误解决方案

2018-01-09  本文已影响926人  HannyYeung

编译环境

配置

应为AndroidStudio打包是基于Gradle命令的,所以这样的话,如果在命令行中使用打包命令就要先配置path环境

打包命令

错误出现1

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/
3.2/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 1572864KB object heap
image.png

错误的原因应该是:Android Studio没有足够空间启动JVM

解决方法

第一种

定位到目录 C:\Users\Administrator.gradle
创建文件gradle.properties
org.gradle.jvmargs=-Xmx512m
重启你的Android Studio项目

第二种

在当前工程下,修改gradle.properties里面:org.gradle.jvmargs=-Xmx512

错误出现2

A problem occurred evaluating project ':clone'.
> Failed to apply plugin [id 'com.android.application']
  > Minimum supported Gradle version is 3.3. Current version is 3.2. If using t
he gradle wrapper, try editing the distributionUrl in D:\ASDemo\learn\clone\grad
le\wrapper\gradle-wrapper.properties to gradle-3.3-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
image.png
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
classpath 'com.android.tools.build:gradle:2.3.3'

Plugin version Required Gradle version
1.0.0 - 1.1.3 2.2.1 - 2.3
1.2.0 - 1.3.1 2.2.1 - 2.9
1.5.0 2.2.1 - 2.13
2.0.0 - 2.1.2 2.10 - 2.13
2.1.3 - 2.2.3 2.14.1+
2.3.0+ 3.3+
3.0.0+ 4.1+

表格来源:https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle

上一篇下一篇

猜你喜欢

热点阅读