0

I published a app on the play store and i am using ACRA for receiving crash reports. I'm getting a lot of these crash reports listed below, which i have never seen before although i tested the app a lot on a lot of devices.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.app.fragments.InfoDetailFragment$1: make sure class name exists, is public, and has an empty constructor that is public
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
        at android.app.ActivityThread.access$600(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:155)
        at android.app.ActivityThread.main(ActivityThread.java:5520)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
        at dalvik.system.NativeStart.main(Native Method)

Its always the fragment "InfoDetailFragment", which like all of my fragments subclasses a BaseFragment.

public static InfoDetailFragment createInstance(String title) {
    InfoDetailFragment frag = new InfoDetailFragment();
    Bundle args = new Bundle();
    args.putString(ARGS_TITLE, title);
    frag.setArguments(args);
    return frag;
}

public InfoDetailFragment() {
    super("InfoDetailFragment");
}

All my fragments are instantiated exactly the same, but the error only appears on this one. Any ideas or hints? Thanks a lot

sebastian
  • 2,610
  • 2
  • 17
  • 28
  • Is this an orientation change issue ?http://stackoverflow.com/questions/8058809/fragment-activity-crashes-on-screen-rotate – IanB Aug 05 '13 at 08:27
  • i thought so too at some point, but i cant reproduce this error with changing the orientation. – sebastian Aug 05 '13 at 08:49
  • I have the very same problem. The Fragment I'm having problem with is in a separate class file as suggested by others http://stackoverflow.com/questions/16464645/java-lang-instantiationexception-cant-instantiate-class-no-empty-construct, but I still have the problem. Did you find out any solution to your problem? – Magnus Johansson Aug 20 '13 at 20:46
  • @Magnus, i added a answer, let me know if it solved your problem too – sebastian Aug 21 '13 at 08:20

2 Answers2

0

Follow up: I updated my support library to rev.18, this seems to have solved the problem.

sebastian
  • 2,610
  • 2
  • 17
  • 28
0

share my experience:

Add empty constructor and/or newInstance() both not work.
clue is class not found, and in my gradle

defaultConfig {
        multiDexEnabled true
    }
dependencies {
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
}

I trun off multiDexEnabled, instead of

defaultConfig {
        //multiDexEnabled true
    }
dependencies {
    //compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-location:8.4.0'
}

(Android Studio 1.5.1, Android API23)

javaing
  • 33
  • 6