1

I've been trying to integrate Facebook ads in my app for Android with the audience-network-sdk:5.0.0 and Facebook sdk crashed with this error:

10-16 13:12:07.128 25301-25725/? D/ProxyCache: Open connection  to http://127.0.0.1:43557/ping
        10-16 13:12:08.318 25301-25586/? E/ProxyCache: Error pinging server [attempt: 2, timeout: 1200]. 
        java.util.concurrent.TimeoutException
            at java.util.concurrent.FutureTask.get(FutureTask.java:176)
            at com.facebook.ads.internal.r.b.f.b(Unknown Source)
            at com.facebook.ads.internal.r.b.f.<init>(Unknown Source)
            at com.facebook.ads.internal.r.b.f.<init>(Unknown Source)
            at com.facebook.ads.internal.f.d$1.a(Unknown Source)
            at com.facebook.ads.internal.f.d$1.call(Unknown Source)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:818)
        Shutdown server... Error pinging server [attempts: 3, max timeout: 1200].
    10-16 13:12:08.318 25301-25586/? I/ProxyCache: Shutdown proxy server
    10-16 13:12:08.328 25301-25602/? W/System.err: java.lang.InterruptedException
    10-16 13:12:08.348 25301-25602/? W/System.err:     at java.lang.Thread.sleep(Native Method)
            at java.lang.Thread.sleep(Thread.java:1031)
            at java.lang.Thread.sleep(Thread.java:985)
            at com.splunk.mint.ExceptionHandler.uncaughtException(ExceptionHandler.java:64)
            at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
            at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
    10-16 13:12:08.348 25301-25602/? E/AndroidRuntime: FATAL EXCEPTION: Thread-12294
        PID: 25301
        java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileDescriptor.setInt$(int)' on a null object reference
            at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:93)
            at java.net.ServerSocket.implAccept(ServerSocket.java:216)
            at java.net.ServerSocket.accept(ServerSocket.java:140)
            at com.facebook.ads.internal.r.b.f.e(Unknown Source)
            at com.facebook.ads.internal.r.b.f.a(Unknown Source)
            at com.facebook.ads.internal.r.b.f$e.run(Unknown Source)
            at java.lang.Thread.run(Thread.java:818)

As you can see the trace just tell you that the ping (and the connection to local host) failed but it doesn't tell you more. I am not solving it because it only happens in physical device and only with my app (the example app from Facebook runs great in the same device and same network).

I don't know why is happening and how to fix it.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

1

So I finally found the error and the solution.

Let me explain the error:

  1. Facebook ads SDK uses localhost Proxy cache to download the assets of the ads

  2. I also use Splunk Mint to track errors of my app in production.

  3. Splunk Mint library has issues with the http monitoring:

Disable network monitoring

The solution was to add this line before init Mint SDK:

Mint.disableNetworkMonitoring();
halfer
  • 19,824
  • 17
  • 99
  • 186
  • `java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileDescriptor.setInt$(int)' on a null object reference` I am getting this error in Facebook Interstitial ad. How to resolve it? – Anand Savjani Nov 24 '18 at 10:38