当前位置: 首页 > 知识库问答 >
问题:

Android Studio:添加aws-java-sdk导致超出GC开销限制

郑鸿朗
2023-03-14

我的年级档案:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v4:19.0.0'
    compile 'org.apache.commons:commons-lang3:3.3'
    compile 'com.google.guava:guava:16.0.1'
    compile 'joda-time:joda-time:2.3'
    compile 'com.amazonaws:aws-java-sdk:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile "org.mockito:mockito-all:1.9.5"
}

这是堆栈轨迹:

Information:Gradle tasks [:backagen:assembleDebug]
Information:UNEXPECTED TOP-LEVEL ERROR:
Information:java.lang.OutOfMemoryError: GC overhead limit exceeded
Information:    at com.android.dx.util.FixedSizeList.<init>(FixedSizeList.java:38)
Information:    at com.android.dx.rop.code.RegisterSpecList.<init>(RegisterSpecList.java:102)
Information:    at com.android.dx.cf.code.RopperMachine.getSources(RopperMachine.java:668)
Information:    at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:288)
Information:    at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:691)
Information:    at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:772)
Information:    at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94)
Information:    at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:698)
Information:    at com.android.dx.cf.code.Ropper.doit(Ropper.java:653)
Information:    at com.android.dx.cf.code.Ropper.convert(Ropper.java:266)
Information:    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:282)
Information:    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
Information:    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
Information:    at com.android.dx.command.dexer.Main.processClass(Main.java:682)
Information:    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
Information:    at com.android.dx.command.dexer.Main.access$600(Main.java:78)
Information:    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
Information:    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Information:    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Information:    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Information:    at com.android.dx.command.dexer.Main.processOne(Main.java:596)
Information:    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
Information:    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
Information:    at com.android.dx.command.dexer.Main.run(Main.java:230)
Information:    at com.android.dx.command.dexer.Main.main(Main.java:199)
Information:    at com.android.dx.command.Main.main(Main.java:103)
Information:1 error
Information:0 warnings
Information:See complete output in console
Error:Execution failed for task ':backagen:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Applications/Android Studio.app/sdk/build-tools/android-4.4.2/dx --dex --output /Users/samwong/AndroidStudioProjects/BackAgen/backagen/build/pre-dexed/debug/aws-java-sdk-1.7.5-131e66c92e708a5c19c92b04dbc3bf0a71acb816.jar /Users/samwong/.gradle/caches/modules-2/files-2.1/com.amazonaws/aws-java-sdk/1.7.5/650f07e69b071cbf41c32d4ea35fd6bbba8e6793/aws-java-sdk-1.7.5.jar
  Error Code:
    3
  Output:
    UNEXPECTED TOP-LEVEL ERROR:
    java.lang.OutOfMemoryError: GC overhead limit exceeded
        at com.android.dx.util.FixedSizeList.<init>(FixedSizeList.java:38)
        at com.android.dx.rop.code.RegisterSpecList.<init>(RegisterSpecList.java:102)
        at com.android.dx.cf.code.RopperMachine.getSources(RopperMachine.java:668)
        at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:288)
        at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:691)
        at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:772)
        at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94)
        at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:698)
        at com.android.dx.cf.code.Ropper.doit(Ropper.java:653)
        at com.android.dx.cf.code.Ropper.convert(Ropper.java:266)
        at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:282)
        at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
        at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
        at com.android.dx.command.dexer.Main.processClass(Main.java:682)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
        at com.android.dx.command.dexer.Main.access$600(Main.java:78)
        at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:596)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
        at com.android.dx.command.dexer.Main.run(Main.java:230)
        at com.android.dx.command.dexer.Main.main(Main.java:199)
        at com.android.dx.command.Main.main(Main.java:103)

共有1个答案

彭俊智
2023-03-14

有一个单独的android-sdk用于android开发。

这在maven中是不存在的,所以您需要从http://aws.amazon.com/sdkforandroid/下载它,然后将所需的jar放在libs/中

但这还不是全部。如果您导入每个jar文件,它会在运行时抛出一个神秘的多dex文件定义'error'。要了解需要哪些JAR,请参阅http://docs.aws.amazon.com/mobile/sdkforandroid/gsg/welcome.html

 类似资料:
  • 我正在尝试预处理一个大的txt文件(10G),并将其存储在二进制文件中以备将来使用。当代码运行时,速度会减慢,并以 异常线程"main"java.lang.OutOfMemoryError: GC开销限制超过 输入文件具有以下结构 这是我正在使用的代码: 基本上,它通过in文件并将数据存储到对象HMbicnt(这是一个哈希映射)。一旦在第二列中遇到新值,它应该将对象写入输出文件,释放内存并继续。

  • 我试图用火花处理10GB的数据,它给了我这个错误, Java语言lang.OutOfMemoryError:超出GC开销限制 笔记本电脑配置为:4CPU,8个逻辑内核,8GB RAM 提交Spark作业时进行Spark配置。 在网上搜索了这个错误后,我有几个问题 如果回答,那将是一个很大的帮助。 1) Spark是内存计算引擎,用于处理10 gb的数据,系统应具有10 gb的RAM。Spark将1

  • 使用当我尝试构建我的项目时,这种错误越来越多: 错误:任务“:app:CompiledEbugJavaWithJavac”执行失败。OutofMemoryError:超出GC开销限制 有什么办法解决这个问题吗?

  • 当我执行我的测试时,我得到了这个错误消息: 我知道什么是,但GC开销限制意味着什么?我怎样才能解决这个问题?

  • 当我运行我的8-puzzle程序时,我不断得到“超出GC开销限制”。我曾尝试向JVM添加更多内存,但没有任何帮助。 这是问题所在的方法: start是我从文件. txt中读取的字符串。它可以解决一些问题,但有些问题会产生此错误。

  • 当我尝试运行TestRun时,我遇到了以下错误。我试了很多,但找不到。帮帮我!我得到了内存不足错误Java堆。运行以下代码也需要更多的时间来运行,最后它显示错误,如下所示。如何使这段代码正确?调试这对我来说非常困难。线程“主”中的异常java.lang.OutOfMemoryError:Java堆空间。 班级总和: 类测试运行: