其他分享
首页 > 其他分享> > Facebook SDK与Android Studio集成

Facebook SDK与Android Studio集成

作者:互联网

我正在尝试将Facebook SDK集成到我的android项目中,但无法这样做.我已按照facebook文档中提到的步骤操作.但我得到的错误是 –

FAILURE:构建因异常而失败.

* What went wrong:
Execution failed for task ':dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Applications/Android Studio.app/sdk/build-tools/19.1.0/dx --dex --num-threads=4 --output /Volumes/Data/projects/project_name/build/intermediates/dex/debug /Volumes/Data/projects/project_name/build/intermediates/classes/debug /Volumes/Data/projects/project_name/build/intermediates/dependency-cache/debug /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/bolts-57446fde6c024f562e020fd9e003407a5fc2a578.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/bugsense-3.5-8ab33d75af263f7f86f49230e10099a1c2c9a549.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/classes-0523eab2b91bd947bf3140cde551a15ef204bab4.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/classes-1bf58233e09b0ba3df3b170e5976ea8835ce9dbc.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/classes-50cb56f46834855caa39a5bee8fee3da46d5c1eb.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/classes-5656b1a26fb9cf46c5e761b517ec752c47e7afe7.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/classes-d98d71fc376b8658355216fd82eb5433791f3b1d.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/custom-linkedin-j-android-46399e5197dc53ee00e0370db8440536b745b26a.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/droidText.0.5-809fa4af200fcd621ea1d4d33c187c85ccfb4721.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/gson-2.2.4-1f9beaae96795dd030e7971a8a89b53987904e64.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/libGoogleAnalyticsServices-969197b4a3de6e6538e72f3e6d598b94488ccd57.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/Parse-1.5.0-e86e2456aff7f83bdad45e275836d6a3e12c84c9.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/signpost-commonshttp4-1.2.1.1-ad7399087713b6c6e45b1e45950da833fcc81870.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/signpost-core-1.2.1.1-50384ca3c3962abba499d71f329139d20bac4475.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/signpost-jetty6-1.2.1.1-96a3b59a9846e0434e4213c2f1c063549d7f2b83.jar /Volumes/Data/projects/project_name/build/intermediates/pre-dexed/debug/support-v4-19.0.1-3bf117e59e2e0f41bbf9219f2be90cdcf1dd583d.jar
  Error Code:
    2
  Output:

    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Cannot merge new index 67781 into a non-jumbo instruction!
        at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:108)
        at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:25)
        at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:71)
        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:48)
        at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:840)
        at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:811)
        at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:783)
        at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:680)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:540)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
        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)

这是我的Facebook gradle文件

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile files('libs/bolts.jar')
}

这是我的项目gradle文件

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':libraries:actionbarsherlock')
    compile project(':libraries:sliding-menu')
    compile project(':libraries:cwac-touchlist')
    compile files('libs/Parse-1.5.0.jar')
    compile 'com.bugsense.trace:bugsense:3.5'
    compile files('libs/gson-2.2.4.jar')
    compile project(':facebook')
}

有什么建议吗?如果您需要任何其他信息,请与我们联系.

解决方法:

您可以检查是否再次导入相同的JAR.假设,jar中有一个类正在另一个jar中导入.所以只需检查是否包含两次lib / class文件.

要么
如果您只是导入一些jar文件,您可以尝试删除它们,并一次添加一个,以查看它们中的哪一个发生错误.
在我的情况下,我做到了这一点,当我导入最后一个时,应用程序确实编译.所以我想,我可能一次导入很多人,这才是真正的问题.但现在一切正常.

标签:android,android-activity,facebook,android-studio,android-facebook
来源: https://codeday.me/bug/20190624/1278143.html