Android Facebook SDK编译错误

Android Facebook SDK编译错误,android,facebook,android-gradle-plugin,facebook-sdk-4.0,Android,Facebook,Android Gradle Plugin,Facebook Sdk 4.0,我试图用Facebook SDK,SDK v4.8.2编译我的项目,但我尝试了最早的版本。以下是我的Gradle构建消息: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException: Cannot merge new index 66457 into a non-jumbo instruction! at com.android.dx.merge.InstructionTransformer.jumboCh

我试图用Facebook SDK,SDK v4.8.2编译我的项目,但我尝试了最早的版本。以下是我的Gradle构建消息:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: Cannot merge new index 66457 into a non-jumbo instruction!
at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:111)
at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)
at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:74)
at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:50)
at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:826)
at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:800)
at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:773)
at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:669)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:523)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':hotelClient:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 8.023 secs
Information:1 error
这个项目有一个旧的facebook库,集成为项目依赖项。但是旧的一个文件已经被删除了

更新

使用多索引

warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of   ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
Uncaught translation error: java.util.concurrent.ExecutionException:     java.lang.OutOfMemoryError: Java heap space
1 error; aborting
Error:Execution failed for task ':hotelClient:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

您的multidex文件有问题,请将以下依赖项添加到您的应用程序Gradle文件中

compile 'com.android.support:multidex:1.0.1'
同时添加以下行:

defaultConfig {

    applicationId 'pkg'
    minSdkVersion 
    targetSdkVersion 
    versionCode 
    versionName 

    // Enable MultiDexing:  https://developer.android.com/tools/building/multidex.html
    multiDexEnabled true
}
编辑:

Manifest.xml
中也添加以下内容:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

...

谢谢

@Drake:也试试这个->