Facebook中的问题为我的Android应用安装广告

时间:2013-02-21 13:28:04

标签: android facebook facebook-ads-api

我正在尝试为我的Android应用安装Facebook安装广告。

遵循https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/中解释的指南。我还从https://github.com/facebook/facebook-android-sdk/archive/sdk-version-3.0.1.b.zip

下载了Facebook-android-sdk

根据上述指南的规定,对于此集成,我必须在所有活动的 onResume()中编写以下代码:

com.facebook.Settings.publishInstallAsync(this, MY_FACEBOOK_APP_ID);

对于上面的集成,我需要Facebook SDK jar。所以我将上面的项目(Facebook-android-sdk)导入我的eclipse IDE并将其导出为jar文件。我已将这个新jar添加到我的libs目录中,该目录也包含在我的Android应用程序的Java Build Path(库)中。

在上述步骤之后,当我尝试调试或运行我的应用程序时,我在控制台中收到以下错误:

[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx 
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/facebook/android/AsyncFacebookRunner$1;
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.dx.command.dexer.Main.run(Main.java:206)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at java.lang.reflect.Method.invoke(Method.java:597)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:703)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:577)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.resources.Project.build(Project.java:124)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1000)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Dx 1 error; aborting
[2013-02-21 18:35:09 - com.org.product.view.welcome.WelcomeView] Conversion to Dalvik format failed with error 1

我对上述错误无能为力,我无法调试/运行我的应用程序。

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

这是由于android-support-v4.jar和我的新facebook-android-sdk中的重复依赖问题。

我已经从facebook-android-sdk创建了一个新的jar(它只使用了我需要的必要项目)并修复了。

谢谢。