title: Android error randomly java.lang.NoClassDefFoundError: com.facebook.internal.Utility
body: <p>I am using latest Facebook Android SDK and getting that error from dozens of users in my remote crash control app in my latest released apk. I have looked here for such error, but most of the answers are too outdated for last FB SDK, and in this case there are two weird circumstances:</p>
  
  <p>a) The error seems to happen randomly. I have been unable to reproduce it at all on none of my devices.</p>
  
  <p>b) There were no changes in FB logic at all between that release and the previous one, and  in the previous release I have never had such error.</p>
  
  <p>Since I couldn't find any relevant difference in the code between such versions, I thought the problem was something wrong could have happened with Android Tools while generating the last apk, but giving the fact that very same apk is the one I am using and have been unable to reproduce the problem and, despite dozens or users are affected, hundreds using the same apk aren't, I discarded also such hypothesis.</p>
  
  <p>Any ideas on how to solve or just debug this thing are welcome.</p>
  
  <p>More info that could be relevant:</p>
  
  <ul>
  <li><strong>All crashes happened in Android 4.0.3 or older.</strong> The highest percentage is for 2.3.6 with 48% of all the crashes.</li>
  <li><p><strong>That class is actually exported in the APK</strong>. I have checked it by unzipping the apk and using dexdump to see what is inside classes.dex. I couldn't expected other thing, since it works perfectly in all my devices and if the class weren't there, it would not.</p>
  
  <p>$ ~/android-sdks/build-tools/21.1.1/dexdump classes.dex | grep 'com.facebook.internal.Utility$1'
    Class descriptor  : 'Lcom/facebook/internal/Utility$1;'
      #0              : (in Lcom/facebook/internal/Utility$1;)
      #1              : (in Lcom/facebook/internal/Utility$1;)
      #2              : (in Lcom/facebook/internal/Utility$1;)
      #0              : (in Lcom/facebook/internal/Utility$1;)
      #0              : (in Lcom/facebook/internal/Utility$1;)
      #1              : (in Lcom/facebook/internal/Utility$1;)
      #2              : (in Lcom/facebook/internal/Utility$1;)
      #3              : (in Lcom/facebook/internal/Utility$1;)</p></li>
  <li><p>It seems to fail after an invocation of a Utility's static method from loadAppSettingsAsync, that happens to be <strong>a static method within the same class</strong>. So, if the com.facebook.internal.Utility class does not exist or couldn't be loaded, how it is possible that com.facebook.internal.Utility.loadAppSettingsAsync is executed in first place? and if it exists and it is loaded, why is NoClassDefFoundError thrown on com.facebook.internal.Utility? I am so f* lost...</p></li>
  </ul>
  
  <p>Here the stack from splunk mint (formerly known as bugsense), I just changed the name of the app. I retraced it with the proguard map file, but it seems it missed some line numbers anyway:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: com.facebook.internal.Utility$1
      at com.facebook.internal.Utility.void loadAppSettingsAsync(android.content.Context,java.lang.String)(Unknown Source)
      at com.facebook.Settings.void sdkInitialize(android.content.Context)(Unknown Source)
      at com.facebook.UiLifecycleHelper.&lt;init&gt;(Unknown Source)
      at net.iberdroid.androidgames.framework.impl.AndroidGame.void onCreate(android.os.Bundle)(Unknown Source)
      at com.marzoa.ruletafree.xmas2012.RuletaAfortunadaGame.void onCreate(android.os.Bundle)(Unknown Source)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
      at android.app.ActivityThread.access$1500(ActivityThread.java:121)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:130)
      at android.app.ActivityThread.main(ActivityThread.java:3770)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:507)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
      at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.ClassNotFoundException: com.facebook.internal.Utility$1 in loader dalvik.system.PathClassLoader[/data/app/com.marzoa.ruletafree.xmas2012-2.apk]
      at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
      ... 18 more
  </code></pre>