Android Studio 添加 percent 依赖后 gradle sync issues失败

AndroidStudio 使用过程中出现的异常(Gradle sync failed)处理办法
作者:李培能
字体:[ ] 类型:转载 时间:
本文主要介绍AndroidStudio 使用过程中出现的异常的解决办法,这里帮大家举例说明,如何处理出现这种问题,有需要的小伙伴可以参考下
AndroidStudio使用过程中出现的异常
异常信息:
Gradle sync failed: 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/2.10/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 object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Consult IDE log for more details (Help | Show Log)
刚开始使用AndroidStudio
在网上看的时候,一直以为是自己gradle.properties文件中
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-Xmx1024m的值太小了,最后发现原来是由于我自己的电脑内存太小,只有2G,而windows系统差不多要占1G左右,所以得把
-Xmx1024m的值改为-Xmx512m才行
以上就是对AndroidStudio 错误资料整理,后续继续补充相关资料,谢谢大家对本站的支持!
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具失败在同步 gradle 项目 Android
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.
我不能同步基本样本项目从 Google Play Services 。我有试着更新 minsdk , targetsdk , compilesdk 版本,更新的项目结构和flavors,但该项目仍然不会 sync 。
这是我的错误︰
Error:Could not find method compile() for arguments [com.android.support:support-v4:24.2.0] on DefaultExternalModuleDependency{group='com.android.support', name='appcompat-v7', version='24.2.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.
Please install the Android Support Repository from the Android SDK Manager.
&a href="openAndroidSdkManager"&Open Android SDK Manager&/a&
但是,安装最新 Android Support Repository (rev 36) 所以我假设问题是别的东西。
如果你想要试着克隆项目︰
这里是我更新 BasicSamples gradle 文件︰
BasicSamples.gradle:
// this is the parent build configuration for all the sample projects.
// for more information on gradle build files when used in a multi-project build, see
// http://gradle.org/docs/current/userguide/multi_project_builds.html
buildscript {
repositories {
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// allprojects apply to every project
allprojects {
repositories {
android_compile_version = 24
android_version = '24.0.1'
android_min_sdk_version = 19
appcompat_library_version = '24.2.0'
support_library_version = '24.2.0'
gms_library_version = '9.4.0'
这里是 BaseGameUtils gradle 文件︰
BaseGameUtils.gradle:
apply plugin: 'com.android.library'
buildscript {
repositories {
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
if (!project.hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
if (!project.hasProperty('gms_library_version')) {
ext.gms_library_version = '8.1.0'
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_compile_version')) {
ext.android_compile_version = 24
if (!project.hasProperty('android_version')) {
ext.android_version = '24'
compileSdkVersion android_compile_version
buildToolsVersion android_version
最后在这里是之一 projects gradle 文件
BeGenerous.gradle:
apply plugin: 'com.android.application'
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
REPLACE THIS VALUE WITH YOUR APPLICATION ID
applicationId "com.google.example.games.replace.me"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
buildTypes {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
productFlavors {
dependencies {
compile "com.android.support:appcompat-v7:${appcompat_library_version}" compile "com.android.support:support-v4:${support_library_version}" compile project(':libraries:BaseGameUtils')
buildscript {
repositories {
解决方法 1:
问题是实际上是一个相当轻微︰ 不是你们结束行后每个依赖项。
dependencies {
compile "com.android.support:appcompat-v7:${appcompat_library_version}" compile "com.android.support:support-v4:${support_library_version}" compile project(':libraries:BaseGameUtils')
dependencies {
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile project(':libraries:BaseGameUtils')
此错误是很常见的当上插件 Android studio编辑或修改 gradle 文件以任何方式,当依赖使用变量而不是直接引用的版本编号。例如,我注意到这发生在我身上,当使用该方法计算的插件或甚至重火力点插件。我用的android studio,添加HttpClient的依赖包之后没有报错,但是编译不通过
首先声明,我使用的是android studio ,SDK用的是最近的23版本。1、因为4.0之后已经没有了HttpClient,我添加了compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'依赖,但是还是找不到HttpClient的包!!这一步有错么?2、然后我又百度加上自己不断换包五六次尝试,添加如下依赖compile 'org.apache.httpcomponents:httpclient-osgi:4.5.1'这个包,能够使用HttpClient了。但是令人崩溃的是居然HttpResponse又用不了,不知道是哪个包的问题。于是又百度加上换各种包尝试了四五次,发现添加compile 'org.apache.httpcomponents:httpcore:4.4.4'这个依赖之后,HttpRespone惊喜的可以用了。这个包导得有没有问题?3、于是噼里啪啦打完代码,一运行,结果编译不过去,提示如下:Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.2 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.2 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.2 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.2 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packagesError:Error converting bytecode to dex:Cause: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/codec/DError:Execution failed for task ':app:transformClassesWithDexForDebug'.& com.android.build.api.transform.TransformException: com.mon.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Program Files\Java\jdk1.8\bin\java.exe'' finished with non-zero exit value 2然后我彻底崩溃了!我也知道这个错误的意思是这个包与androidSDK的内部版本冲突,但是你的内部版本不能用啊,我把compile 'org.apache.httpcomponents:httpclient-osgi:4.5.1'依赖删除之后立马报错,各种找不到类找不到方法。我无数次实验,只有compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'compile 'org.apache.httpcomponents:httpcore:4.4.4'compile 'org.apache.httpcomponents:httpclient-osgi:4.5.1'三个依赖全导才不报错下图里面所有的apache的httpClient的依赖我通通导了个遍,并且所有排列组合都尝试过,两两搭配三三搭配,单独一个包。最后无解!我自认为我真是拼了老命想靠自己来解决问题,但是喷了屏幕一口血,也没办法!希望大神帮帮我!
24885 浏览
非常感谢!正在研究volley!
主要是看到麦子学院、慕课的课程HttpClient还占有相当大的比重
写下你的评论...
我用的4.5.2的版本,这个方法现在好像也失效了
哥们,能具体的说一下嘛, 添加的依赖, 都有什么
写下你的评论...
成功找到,不知道运行有无问题。
org.apache.http.client
找到 但是我还没运行 不过已经很高兴了 谢谢你
写下你的评论...
写下你的评论...
写下你的评论...
写下你的评论...
写下你的评论...
我的成功了
写下你的评论...
Copyright (C)
All Rights Reserved | 京ICP备 号-25112人阅读
这是我使用AS 的一些笔记,避免出现问题找来找去的,也希望能帮助到有需要的朋友,大神可无视。
使用android studio时如果不进行配置,默认是每次启动都进行网络gradle sync的方法,也就是说,没网络的情况下是无法编译的,以下是我在使用中的解决方法:
先下载好gradle,然后按照上图的设置设置一下就可以了非常简单
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:5357次
排名:千里之外
(window.slotbydup = window.slotbydup || []).push({
id: '4740887',
container: s,
size: '250,250',
display: 'inlay-fix'

我要回帖

更多关于 android gradle sync 的文章

 

随机推荐