gpt4 book ai didi

java - Java用非零退出值1完成-Android Gradle

转载 作者:行者123 更新时间:2023-12-03 06:13:26 25 4
gpt4 key购买 nike

  • Gradle Build:运行正常。
  • 重建项目:运行正常。
  • 清洁项目:运行正常。
  • 运行:它显示以下内容:

  • 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



    详细错误:

    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



    我在“quickblox”的lib文件夹中添加了3个jar文件。我已经引用了与我的问题有关的所有帖子,但是我无法成功构建该项目。我也启用

    multiDexEnabled true



    我的构建Gradle文件:
    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.



    从6.5版开始,您可以选择将Google Play服务API 编译到您的应用中。 例如,若要 仅包括Google Fit和Android Wear API ,请在build.gradle文件中替换以下行:
    compile 'com.google.android.gms:play-services:8.1.0'

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

    有关更多信息,请引用: https://developers.google.com/android/guides/setup#split

    它类似于而不是使用 import.example.pkg1.*,而是执行 import.example.pkg1.RequiredClass ,因此仅包括您需要的那些播放服务包并检查...
    还要检查其他库...它们是否包含具有相同名称的类,那么在这种情况下,您将处理一个库

    关于java - Java用非零退出值1完成-Android Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32844287/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com