Why does my android app crashes on start directly after install?
<p>Some clients experience an app crash directly when they launch it. </p>

<p>Here's the code of the onCreate() method in the main activity : </p>

<pre><code>public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    String deviceId = Local.getUniqueID(this);

    Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(deviceId));

    setContentView(R.layout.main);
}
</code></pre>

<p>and <code>getUniqueId()</code> does that :</p>

<pre><code>public static String getUniqueID(Context context) {
     return Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
}
</code></pre>

<p>Is it possible that this call makes the app crash ? May I call this in <code>onCreate()</code> ?
Or is it <code>Thread.setDefaultUncaughtExceptionHandler()</code> that crashes ?</p>

<p>The users who experience this problem don't even see the splashscreen of the app and I was unable to reproduce the problem on any device I own.</p>

<p><code>CustomExceptionHandler</code> just get the stack trace of the exception/error and sends it to the server with the device id. I got a device id from a user who experienced the problem and it's not in the database.</p>

<p>Any idea? I never had that problem along the development on any device. What could be the cause of this? Don't hesitate to ask for more details.
Thanks</p>

<p>Edit:
I think I found what would be the stacktrace when the application crashes : </p>

<pre><code>E/AndroidRuntime(10067): FATAL EXCEPTION: main
E/AndroidRuntime(10067): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
E/AndroidRuntime(10067):    at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
E/AndroidRuntime(10067):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3909)
E/AndroidRuntime(10067):    at android.app.ActivityThread.access$1300(ActivityThread.java:122)
E/AndroidRuntime(10067):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1184)
E/AndroidRuntime(10067):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10067):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(10067):    at android.app.ActivityThread.main(ActivityThread.java:4340)
E/AndroidRuntime(10067):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(10067):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(10067):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(10067):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(10067):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(10067): Caused by: java.lang.NullPointerException
E/AndroidRuntime(10067):    at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
E/AndroidRuntime(10067):    at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
E/AndroidRuntime(10067):    at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
E/AndroidRuntime(10067):    ... 11 more
</code></pre>
