NoClassDefFoundError when App gets restored
<p><strong>Prologue:</strong> My app starts a service on start up, which requests a json from my server and parses it.
this works perfectly except for one sitatuon:</p>

<p><strong>Condition:</strong> The "Automatic restore" option is enabled on the phone and the app has been installed on the linked account before.</p>

<p><strong>Case 1:</strong> immediately after the installation via adb finished, the service mentioned above is started and runs into a "NoClassDefFoundError". So i get the "App has stopped working."-popup and thats it. After this the app works perfectly again, no more errors.</p>

<p>What i have tried:</p>

<p><strong>Case 2:</strong> I moved the execution of the service into the MainActivity instead of the Application.java - so the service does not get started when the backup is run but when its really started by the user. For a short moment i thought this helped, but now the error occurs later in the App - again only one single time. After that first crash it works flawlessly.</p>

<p>I really cant get my head around this problem, especially the fact that the crash occurs only one single time confuses me.</p>

<p><strong>The Stacktrace for Case 1:</strong> (for Case 2 its not the GeoPoint that is not found but com.google.android.maps.MapView)</p>

<pre><code>02-06 14:16:02.632: E/AndroidRuntime(6164): Caused by: java.lang.NoClassDefFoundError: com/google/android/maps/GeoPoint
02-06 14:16:02.632: E/AndroidRuntime(6164):     at java.lang.Class.getDeclaredFields(Native Method)
02-06 14:16:02.632: E/AndroidRuntime(6164):     at java.lang.Class.getDeclaredFields(Class.java:647)
02-06 14:16:02.632: E/AndroidRuntime(6164):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:109)
02-06 14:16:02.632: E/AndroidRuntime(6164):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
02-06 14:16:02.632: E/AndroidRuntime(6164):     at com.google.gson.Gson.getAdapter(Gson.java:353)
02-06 14:16:02.632: E/AndroidRuntime(6164):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.&lt;init&gt;(ReflectiveTypeAdapterFactory.java:82)
02-06 14:16:02.632: E/AndroidRuntime(6164):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)...
</code></pre>
