不是在[0,0xFFFF的]方法ID,更新内容为1.0,得到&QUOT后:65536"项目错误 [英] After update of AS to 1.0, getting "method ID not in [0, 0xffff]: 65536" error in project

查看:400
本文介绍了不是在[0,0xFFFF的]方法ID,更新内容为1.0,得到&QUOT后:65536"项目错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新的Andr​​oid工作室到最新版本,并让它修复工程之类的 - 但现在我的计划没有编制,给了​​我

I updated Android Studio to the latest version, and let it "fix the project" and the like - but now my project does not compile, gives me

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    D:\VGA\AndroidStudio\sdk\build-tools\21.1.1\dx.bat --dex --no-optimize --output D:\VGA\Projects\Sales-App\Android-Project\svn\android\app\build\intermediates\dex\debug --input-list=D:\VGA\Projects\Sales-App\Android-Project\svn\android\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:

    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
        at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
        at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
        at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
        at com.android.dx.command.dexer.Main.run(Main.java:245)
        at com.android.dx.command.dexer.Main.main(Main.java:214)
        at com.android.dx.command.Main.main(Main.java:106)

然而,这是不是只是multidexing,因为当我加入这个解决:

However, this isn't resolved by just multidexing, because when I added this:

defaultConfig {
    ...
    multiDexEnabled = true
}

这会发生

D:\VGA\AndroidStudio\sdk\build-tools\21.1.1\dx.bat --dex --no-optimize --multi-dex --main-dex-list D:\VGA\Projects\Sales-App\Android-Project\svn\android\app\build\intermediates\multi-dex\debug\maindexlist.txt --output D:\VGA\Projects\Sales-App\Android-Project\svn\android\app\build\intermediates\dex\debug --input-list=D:\VGA\Projects\Sales-App\Android-Project\svn\android\app\build\intermediates\tmp\dex\debug\inputList.txt

错误code:     3 输出:

Error Code: 3 Output:

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at com.android.dx.cf.code.ConcreteMethod.makeSourcePosistion(ConcreteMethod.java:254)
    at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:306)
    at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal(Simulator.java:612)
    at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:367)
    at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94)
    at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787)
    at com.android.dx.cf.code.Ropper.doit(Ropper.java:742)
    at com.android.dx.cf.code.Ropper.convert(Ropper.java:349)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
    at com.android.dx.command.dexer.Main.processClass(Main.java:729)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:82)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    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:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:505)
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:332)
    at com.android.dx.command.dexer.Main.run(Main.java:243)
    at com.android.dx.command.dexer.Main.main(Main.java:214)
    at com.android.dx.command.Main.main(Main.java:106)

我试图改变构建工具最新

I tried changing the build tools to latest

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

由于默认情况下它更改为20.0.0这似乎使用的SDK的4.4W,但这并没有解决我的问题。

Because by default it changed to 20.0.0 which seemed to use the SDK for 4.4W, but this didn't fix my problem.

有谁知道什么可能是错在这里?

Does anyone know what could be wrong here?

编辑:

修改构建工具或编译的SDK并没有解决问题。

Changing the build tools or the compile SDK did not fix the problem.

打开应用程序成多DEX项目,并添加以下

Turning the app into a multi-dex project and also adding the following

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        ...
        multiDexEnabled true
    }

...
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}

修正了构建过程,然而,这似乎仍然只是一种待遇,而不是一个固定的问题。

Fixed the build process, however this still seems to be just a "treatment" but not a fix to the problem.

我不知道这是否是相关的,但是这是我的依赖性列表:

I am not sure if this is related, but this is my dependency list:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile 'com.squareup:otto:1.3.5'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.squareup.retrofit:retrofit:1.7.1'
    compile 'com.jakewharton:butterknife:6.0.0'
    compile 'com.madgag.spongycastle:core:1.51.0.0'
    compile 'com.madgag.spongycastle:prov:1.51.0.0'
    compile 'com.madgag.spongycastle:pkix:1.51.0.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'commons-io:commons-io:2.4'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
    compile 'com.squareup.dagger:dagger:1.2.2'
    compile 'com.squareup.dagger:dagger-compiler:1.2.2'
    compile('com.googlecode.json-simple:json-simple:1.1.1') {
        exclude module: 'junit'
    }
    compile 'com.google.android.gms:play-services:6.5.87'
}

自那时以来,唯一新的依赖一直是最后一行,这是我加按<一个href="https://developer.android.com/google/gcm/client.html">https://developer.android.com/google/gcm/client.html所以我不认为这是问题的根源。

The only new dependency since then has been the last line, which I added as per https://developer.android.com/google/gcm/client.html so I don't think that is the source of the problem.

EDIT2:

是的,这是问题的根源。当我需要谷歌云消息传递,我取代了依赖与基地按<一个href="http://developer.android.com/google/play-services/setup.html#split">http://developer.android.com/google/play-services/setup.html#split

Yes, it was the source of the problem. As I needed Google Cloud Messaging, I replaced that dependency with the base as per http://developer.android.com/google/play-services/setup.html#split :

compile 'com.google.android.gms:play-services-base:6.5.87'

和它解决了这一问题。谢谢你的帮助。

And it fixed the problem. Thank you for the help.

EDIT3:

由于播放服务7.0.0中,GCM是

As of play services 7.0.0, the GCM is in

compile 'com.google.android.gms:play-services-gcm:7.0.0'

EDIT4:

播放服务更新到7.3.0。 请保持检查这里的最新版本:<一href="http://developer.android.com/google/play-services/setup.html#split">http://developer.android.com/google/play-services/setup.html#split

Play Services updated to 7.3.0. Please keep check of the latest version here: http://developer.android.com/google/play-services/setup.html#split

推荐答案

您已经于您的应用程序达到最高法计数错误的手段。这不包括您用于项目的所有库。

The error means you have reached maximum method count in your app. That does include any libraries that you use for your project.

有两种方法来解决这个问题:

There are two ways to tackle the issue:

  1. 摆脱任何你真的不需要第三方库。如果你使用谷歌播放可能有助于很多方法计数服务。幸运的是作为最新的播放服务的释放它可以包括只有部分的中的框架。
  2. 使用一个多DEX设置为您的应用。
  1. Get rid of any third-party libraries that you don't really need. If you use google play services that might contribute a lot to the method count. Fortunately as of the latest play-services release it is possible to include only parts of the framework.
  2. Use a multi dex setup for your application.

这篇关于不是在[0,0xFFFF的]方法ID,更新内容为1.0,得到&QUOT后:65536&QUOT;项目错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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