繁体   English   中英

Android Studio Gradle错误:使用离子库什库执行任务':app:dexDebug'的执行失败

[英]Android Studio Gradle Error:Execution failed for task ':app:dexDebug' using Ion koush lib

我想在Android Studio中使用koush的Ion Lib。 但是,当我同步gradle文件中的库并尝试运行该应用程序后,会发生奇怪的错误。

我的想法是,离子库不接受我的gradle文件中的其他库。

Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon902Library UP-TO-DATE
:app:prepareComKoushikduttaAsyncAndroidasync218Library UP-TO-DATE
:app:prepareComKoushikduttaIonIon218Library UP-TO-DATE
:app:prepareComRengwuxianMaterialedittextLibrary214Library UP-TO-DATE
:app:prepareComSpecyciResidemenu16Library 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:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava 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
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
6 errors; aborting
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_51\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED

我的Gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "sample.test.soft"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.specyci:residemenu:1.6+'
    compile 'com.koushikdutta.ion:ion:2.1.8'
    compile 'com.koushikdutta.async:androidasync:2.1.8'
}

在我的gradle文件中,我用版本号替换了ion和androidasync的“ +”号。

首先用编译

编译'com.android.support:multidex:1.0.1'

编译'com.google.android.gms:play-services:+'

在您的AndroidManifest.xml中添加以下行android:name

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:name="android.support.multidex.MultiDexApplication"
    >

并且在您的build.gradle中还添加

dexOptions {
    //incremental = true;
    preDexLibraries = false
    javaMaxHeapSize "4g"
}

从日志中您已发布j ava.lang.OutOfMemoryError:超出了GC开销限制 看来您的Android Studio内存不足。

要提高dexing操作的堆限制,请将其添加到您的android闭包中:

dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }

这将解决所有GC开销问题,并且您可以拥有更多的依赖项。 并且我注意到您正在从Google Play编译整个服务com.google.android.gms:play-services:9.0.2

选择性地将API编译到可执行文件中

在6.5之前的Google Play服务版本中,您必须将整个API包编译到您的应用中。 在某些情况下,这样做会使将应用程序中的方法数量(包括框架API,库方法和您自己的代码)保持在65,536个限制以下变得更加困难。 从6.5版开始,您可以选择将Google Play服务API编译到您的应用中。

阅读进一步。

第一个清洁项目。 对我来说,当我从依赖项中删除Google play的类路径时,它起作用了,现在看起来像这样:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM