Java的完成与非零退出值1 - Android的摇篮 [英] Java finished with non-zero exit value 1 - Android Gradle

查看:476
本文介绍了Java的完成与非零退出值1 - Android的摇篮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 摇篮构建:做工精细

  2. 重建项目:做工精细。

  3. 清理项目:做工精细。

  4. 运行:它显示以下内容:


  

错误:执行失败的任务:应用程序:dexDebug。 > com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.7.0_71 \\斌\\ java.exe的'非完成 - 零退出值


详细错误:


  

信息:摇篮任务[:应用:assembleDebug]
  :应用程序:preBuild UP-TO-DATE
  :应用程序:preDebugBuild UP-TO-DATE
  :应用:checkDebugManifest
  :应用程序:preReleaseBuild UP-TO-DATE
  :应用程序:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
  :应用程序:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE
  :应用程序:prepareComAndroidSupportMultidex101Library UP-TO-DATE
  :应用程序:prepareComAndroidSupportRecyclerviewV72220Library UP-TO-DATE
  :应用程序:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
  :应用程序:prepareComCrashlyticsSdkAndroidAnswers102Library UP-TO-DATE
  :应用程序:prepareComCrashlyticsSdkAndroidBeta102Library UP-TO-DATE
  :应用程序:prepareComCrashlyticsSdkAndroidCrashlytics210Library UP-TO-DATE
  :应用程序:prepareComDigitsSdkAndroidDigits180Library UP-TO-DATE
  :应用程序:prepareComFacebookAndroidFacebookAndroidSdk460Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServices810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesAppinvite810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesAppstate810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesCast810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesDrive810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesFitness810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesGames810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesGcm810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesIdentity810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesLocation810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesMaps810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesNearby810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesPanorama810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesSafetynet810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesVision810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesWallet810Library UP-TO-DATE
  :应用程序:prepareComGoogleAndroidGmsPlayServicesWearable810Library UP-TO-DATE
  :应用程序:prepareComTwitterSdkAndroidTweetComposer090Library UP-TO-DATE
  :应用程序:prepareComTwitterSdkAndroidTweetUi150Library UP-TO-DATE
  :应用程序:prepareComTwitterSdkAndroidTwitter180Library UP-TO-DATE
  :应用程序:prepareComTwitterSdkAndroidTwitterCore150Library UP-TO-DATE
  :应用程序:prepareIoFabricSdkAndroidFabric135Library UP-TO-DATE
  :应用程序:prepareDebugDependencies
  :应用:compileDebugAidl UP-TO-DATE
  :应用:compileDebugRenderscript UP-TO-DATE
  :应用:generateDebugBuildConfig UP-TO-DATE
  :应用:generateDebugAssets UP-TO-DATE
  :应用:mergeDebugAssets UP-TO-DATE
  :应用:generateDebugResValues​​ UP-TO-DATE
  :应用:generateDebugResources UP-TO-DATE
  :应用:mergeDebugResources UP-TO-DATE
  :应用:processDebugManifest UP-TO-DATE
  :应用:fabricGenerateResourcesDebug
  :应用:processDebugResources
  :应用:generateDebugSources
  :应用:processDebugJavaRes UP-TO-DATE
  :应用:compileDebugJavaWithJavac UP-TO-DATE
  :应用:compileDebugNdk UP-TO-DATE
  :应用:compileDebugSources UP-TO-DATE
  :应用:collectDebugMultiDexComponents UP-TO-DATE
  :应用:packageAllDebugClassesForMultiDex UP-TO-DATE
  :应用:shrinkDebugMultiDexComponents UP-TO-DATE
  :应用:createDebugMainDexClassList UP-TO-DATE
  :应用:dexDebug
  错误:无法创建Java虚拟机。
  错误:发生了致命的异常。计划将退出。
  无效的最大堆大小:-Xmx4g
  指定的大小超过最大重presentable大小。
  错误:执行失败的任务:应用程序:dexDebug。
  com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.7.0_71 \\斌\\ java.exe的''与非完零退出值1
  资料:构建失败
  信息:总时间:12.312秒
  信息:1错误
  信息:0警告
  信息:查看控制台完成输出


我在我的libquickblox文件夹中三个文件。我已审阅所有有关我的问题的帖子,但我不能够成功构建项目。我也有启用


  

multiDexEnabled真正


我的构建摇篮文件:

 应用插件:'com.android.application安卓{
compileSdkVersion 23
buildToolsVersion '23 .0.0defaultConfig {
    的applicationIDxxx.xxx.xxx
    15的minSdkVersion
    targetSdkVersion 21
    版本code 1
    的versionName1.0
    multiDexEnabled真
}
buildTypes {
    发布 {
        minifyEnabled假
        proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
    }
}dexOptions {
    javaMaxHeapSize4G
}}
buildscript {
库{
    行家{URLhttps://maven.fabric.io/public'}
}依赖{
    类路径'io.fabric.tools:gradle:1.+
}
}应用插件:'io.fabric库{
行家{URLhttps://maven.fabric.io/public'}
}依赖{
编译文件树(导演:'库',包括:['的* .jar'])
编译com.android.support:appcompat-v7:23.0.0
编译com.google code.gson:GSON:2.3
编译com.squareup.retrofit:改造:1.9.0
编译com.squareup.retrofit:改造-模拟:1.9.0
编译com.jakewharton:奶油刀:7.0.1
编译com.squareup.picasso:毕加索:2.4.0
编译com.facebook.android:facebook-android-sdk:4.6.0
编译com.squareup.okhttp:okhttp:2.3.0
编译com.squareup.okhttp:okhttp-的URLConnection:2.3.0
编译com.android.support:recyclerview-v7:22.2.0
编译com.google.android.gms:播放服务:+'
编译com.android.support:multidex:1.0.0
编译('com.crashlytics.sdk.android:crashlytics:2.1.0@aar'){
    传递= TRUE;
}
编译('com.twitter.sdk.android:twitter:1.8.0@aar'){
    传递= TRUE;
}
编译文件(库/ quickblox-Android的SDK-聊天2.3.1.jar')
编译文件(库/ quickblox-Android的SDK核心-2.3.1.jar')
编译文件(库/ quickblox-Android的SDK的消息-2.3.1.jar')
}


解决方案

  

在谷歌的6.5之前的Play服务的版本,你必须编译
  整个包的API为您的应用程序。在某些情况下,这样做取得
  它更难以保持的方法的数量在应用程式(包括
  框架API,库方法,和你自己的code)根据65536
  限制。


6.5版本,你可以选择,而不是谷歌编译播放服务API 到您的应用程序。 例如,到只包括谷歌飞度和Android API的磨损,替换下面的行中您的build.gradle文件:

 编译com.google.android.gms:发挥服务:8.1.0

这些行:

 编译com.google.android.gms:发挥服务的健身:8.1.0
编译com.google.android.gms:播放服务耐磨:8.1.0

有关详细信息请参阅: https://developers.google.com/android/guides /设置#分裂

这是一个类似的,而不是使用 import.example.pkg1。* 我们 import.example.pkg1.RequiredClass 结果的所以只包括那些播放服务包,你需要检查... 搜索结果
此外,还要检查其他图书馆以及...它们是否包含具有相同的名称类别或没有,那么在这种情况下,你将围绕做的工作有一个库

  1. Gradle Build : Working fine.
  2. Rebuild Project: Working fine.
  3. Clean Project: Working Fine.
  4. Run: It shows following:

Error: Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_71\bin\java.exe'' finished with non-zero exit value

Detail Error:

Information:Gradle tasks [:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE :app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72220Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidAnswers102Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidBeta102Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidCrashlytics210Library UP-TO-DATE :app:prepareComDigitsSdkAndroidDigits180Library UP-TO-DATE :app:prepareComFacebookAndroidFacebookAndroidSdk460Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServices810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppinvite810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppstate810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCast810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesDrive810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesFitness810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGames810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesIdentity810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesLocation810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMaps810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesNearby810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPanorama810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesSafetynet810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesVision810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWallet810Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesWearable810Library UP-TO-DATE :app:prepareComTwitterSdkAndroidTweetComposer090Library UP-TO-DATE :app:prepareComTwitterSdkAndroidTweetUi150Library UP-TO-DATE :app:prepareComTwitterSdkAndroidTwitter180Library UP-TO-DATE :app:prepareComTwitterSdkAndroidTwitterCore150Library UP-TO-DATE :app:prepareIoFabricSdkAndroidFabric135Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:fabricGenerateResourcesDebug :app:processDebugResources :app:generateDebugSources :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:collectDebugMultiDexComponents UP-TO-DATE :app:packageAllDebugClassesForMultiDex UP-TO-DATE :app:shrinkDebugMultiDexComponents UP-TO-DATE :app:createDebugMainDexClassList UP-TO-DATE :app:dexDebug Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Invalid maximum heap size: -Xmx4g The specified size exceeds the maximum representable size. Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_71\bin\java.exe'' finished with non-zero exit value 1 Information:BUILD FAILED Information:Total time: 12.312 secs Information:1 error Information:0 warnings Information:See complete output in console

I have added 3 jar files in my lib folder of "quickblox". I have refereed to all the post related to my problem, but i was not able to successfully build the project. Also i have enable

multiDexEnabled true

My Build Gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '23.0.0'

defaultConfig {
    applicationId "xxx.xxx.xxx"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
    multiDexEnabled  true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dexOptions {
    javaMaxHeapSize "4g"
}

}


buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}



apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.retrofit:retrofit-mock:1.9.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile('com.crashlytics.sdk.android:crashlytics:2.1.0@aar') {
    transitive = true;
}
compile('com.twitter.sdk.android:twitter:1.8.0@aar') {
    transitive = true;
}
compile files('libs/quickblox-android-sdk-chat-2.3.1.jar')
compile files('libs/quickblox-android-sdk-core-2.3.1.jar')
compile files('libs/quickblox-android-sdk-messages-2.3.1.jar')
}

解决方案

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:

compile 'com.google.android.gms:play-services:8.1.0'

with these lines:

compile 'com.google.android.gms:play-services-fitness:8.1.0'
compile 'com.google.android.gms:play-services-wearable:8.1.0'

For more info refer : https://developers.google.com/android/guides/setup#split

It is similar to instead of using import.example.pkg1.* we do import.example.pkg1.RequiredClass
So Include only those play service package you need and check...

Also check for other libraries as well...whether they contain Classes with same name or not then in that case you will do work around with one library

这篇关于Java的完成与非零退出值1 - Android的摇篮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆