I cannot get the demo project for Facebook Audience Network working.

I created sample adds on my Facebook account and updated the variables 

local bannerPlacementID = "my banner ID" local interstitialPlacementID = "my interstitial ID"

Looks like it cannot be tested in the emulator because it show this on the log:

`WARNING: The ‘plugin.fbAudienceNetwork’ library is not available on this platform.

`

When I build and install on my Android device the log shows error messages for 

com.google.android.gms.ads.identifier.AdvertisingIdClient. 

10-23 00:55:50.096: E/AndroidRuntime(25977): Process: com.hotmail.adammendoza.plugins\_sample\_fbAudienceNetwork\_master, PID: 25977 10-23 00:55:50.096: E/AndroidRuntime(25977): java.lang.RuntimeException: An error occurred while executing doInBackground() 10-23 00:55:50.096: E/AndroidRuntime(25977): at android.os.AsyncTask$3.done(AsyncTask.java:309) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.util.concurrent.FutureTask.setException(FutureTask.java:223) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 10-23 00:55:50.096: E/AndroidRuntime(25977): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.Thread.run(Thread.java:818) 10-23 00:55:50.096: E/AndroidRuntime(25977): Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient; 10-23 00:55:50.096: E/AndroidRuntime(25977): at plugin.fbAudienceNetwork.CoronaBeacon$1$1.doInBackground(CoronaBeacon.java:79) 10-23 00:55:50.096: E/AndroidRuntime(25977): at plugin.fbAudienceNetwork.CoronaBeacon$1$1.doInBackground(CoronaBeacon.java:72) 10-23 00:55:50.096: E/AndroidRuntime(25977): at android.os.AsyncTask$2.call(AsyncTask.java:295) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 10-23 00:55:50.096: E/AndroidRuntime(25977): ... 4 more 10-23 00:55:50.096: E/AndroidRuntime(25977): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.identifier.AdvertisingIdClient" on path: DexPathList[[zip file "/data/app/com.hotmail.adammendoza.plugins\_sample\_fbAudienceNetwork\_master-1/base.apk"],nativeLibraryDirectories=[/data/app/com.hotmail.adammendoza.plugins\_sample\_fbAudienceNetwork\_master-1/lib/arm, /data/app/com.hotmail.adammendoza.plugins\_sample\_fbAudienceNetwork\_master-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] 10-23 00:55:50.096: E/AndroidRuntime(25977): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 10-23 00:55:50.096: E/AndroidRuntime(25977): ... 8 more 10-23 00:55:50.096: E/AndroidRuntime(25977): Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.ads.identifier.AdvertisingIdClient 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.Class.classForName(Native Method) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 10-23 00:55:50.096: E/AndroidRuntime(25977): at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 10-23 00:55:50.096: E/AndroidRuntime(25977): ... 9 more 10-23 00:55:50.096: E/AndroidRuntime(25977): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available 10-23 00:55:50.131: E/android.os.Debug(2596): ro.product\_ship = true 10-23 00:55:50.131: E/android.os.Debug(2596): ro.debug\_level = 0x4f4c 10-23 00:55:50.131: E/android.os.Debug(2596): sys.mobilecare.preload = false 10-23 00:55:50.871: E/ViewSystem(25977): ViewRootImpl #2 Surface is not valid. 10-23 00:55:51.231: E/WindowManager(25977): android.view.WindowLeaked: Activity com.ansca.corona.CoronaActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{d92b25 V.E...... R.....ID 0,0-668,602} that was originally added here 10-23 00:55:51.231: E/WindowManager(25977): at android.view.ViewRootImpl.\<init\>(ViewRootImpl.java:568) 10-23 00:55:51.231: E/WindowManager(25977): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:326) 10-23 00:55:51.231: E/WindowManager(25977): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 10-23 00:55:51.231: E/WindowManager(25977): at android.app.Dialog.show(Dialog.java:350) 10-23 00:55:51.231: E/WindowManager(25977): at com.ansca.corona.Controller$4.run(Controller.java:1079) 10-23 00:55:51.231: E/WindowManager(25977): at android.os.Handler.handleCallback(Handler.java:739) 10-23 00:55:51.231: E/WindowManager(25977): at android.os.Handler.dispatchMessage(Handler.java:95) 10-23 00:55:51.231: E/WindowManager(25977): at android.os.Looper.loop(Looper.java:158) 10-23 00:55:51.231: E/WindowManager(25977): at android.app.ActivityThread.main(ActivityThread.java:7230) 10-23 00:55:51.231: E/WindowManager(25977): at java.lang.reflect.Method.invoke(Native Method) 10-23 00:55:51.231: E/WindowManager(25977): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 10-23 00:55:51.231: E/WindowManager(25977): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 10-23 00:55:51.491: E/ViewRootImpl(2596): sendUserActionEvent() mView == null 10-23 00:55:52.181: E/ContactsProvider\_EventLog(4921): Flush buffer to file cnt : 8 size : 2Kb duration : 100ms lastUpdatedAfter : 180394ms 10-23 00:56:00.071: E/Watchdog(2596): !@Sync 12892 [10-23 00:56:00.074]

Can you post your build.settings file please?

Thanks

Rob

This is in the build.setting file. 

Other than updating the banner ad ID, it’s the same project on GitHub. 

https://github.com/coronalabs/plugins-sample-fbAudienceNetwork

---- For more information on build.settings see the Corona SDK Build Guide at: -- http://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- settings = { orientation = { default = "portrait", supported = { "portrait", "portraitUpsideDown" } }, iphone = { plist = { CFBundleIconFiles = { "Icon.png",&nbsp; "Icon@2x.png",&nbsp; "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png",&nbsp; "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-167.png", "Icon-Small.png",&nbsp; "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png",&nbsp; "Icon-Small-50@2x.png", }, }, }, window = { titleText = { default = "Facebook Audience Network", }, }, plugins = { ["plugin.fbAudienceNetwork"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, }, }

You need to include this in your build.settings in the plugin table:

 ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } },

Rob

I have the same problem and I did include the build.settings configuration. I still don’t see anything when I click on the load and show banner ads button. Please let me know how to check the logs when run on the device.

See: https://docs.coronalabs.com/guide/basics/debugging/index.html

Rob,

Well, I did install the android studio and managed to run the sample application. I am getting the banner ad to be displayed on my phone. I am just unable to retrieve the device hash Id from the device console. I opened the Android monitor and I see the logCat tab. I see logs getting loaded. I did an edit to the filters to show only logs with the package name with the debug level of verbose. Nothing shows up. Whereas, when I run without any filters it keeps loading the logs and its unstoppable. Please let me know how to get this fixed.  

I’m not sure what device hash your looking for. If you’re getting your ads, it sounds like its working. 

Rob,

According to their fbAudienceNetwork documentation, Facebook wants to pass the device hash ID for testing. I am following the steps mentioned in the page https://docs.coronalabs.com/plugin/fbAudienceNetwork/init.html. I have placed an excerpt from the instructions below indicating what I am trying to do. 

Important

Facebook has a method for calling test ads which is different from other Corona ad providers. To test ads during implementation of this plugin, you must follow their requirements as follows:

  • Each testing device must be initialized within the system via a device hash ID. To gather a hash ID, you must first build and install your app on the device with a basic implementation of the Facebook Audience Network plugin. Next, call fbAudienceNetwork.load(). At this point, with the device connected, the app will output a message similar to the following to the device console log:

Test mode device hash: [HASHID]

This device hash can be used as one of the device hash IDs outlined below. For more information on accessing the device console log, see the Device Debugging sections of the Debugging Guide.

  • If you uninstall/remove your app from the device and then build/install it again, Facebook will generate a new device hash ID which you must update in your code.