【问题标题】:Facebook SDK compilation errorFacebook SDK 编译错误
【发布时间】:2016-03-19 17:55:30
【问题描述】:

我正在尝试使用 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

【问题讨论】:

标签: android facebook android-gradle-plugin facebook-sdk-4.0


【解决方案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>

谢谢..!!

【讨论】:

猜你喜欢
  • 2015-02-24
  • 1970-01-01
  • 1970-01-01
  • 2013-02-03
  • 1970-01-01
  • 2011-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多