Crashes with new live wallpapers

Discussion in 'Help & Support' started by stollo770, Sep 24, 2013.

  1. stollo770 LWC Major

    Member Since:
    Feb 2, 2012
    Message Count:
    236
    Likes Received:
    64
    Trophy Points:
    200
    Hey @Vas, I've recently been getting error reports for some of my new live wallpapers with a splash activity, though I am not sure if its related to the splash activity. Everything works fine on my GS3, and the problem seems confined to more "budget" phones, but I still want to make sure that all my users are happy. Here is the error report that the crashed live wallpapers are sending to my google account:

    Code (text):
    java.lang.RuntimeException: Unable to start activity ComponentInfo{examplecomanyname.exampleappname/com.sbg.lwc.LiveWallpaperSettings}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
    at android.app.ActivityThread.access$700(ActivityThread.java:134)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4867)
    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:1007)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
    at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:242)
    at android.preference.Preference.getPersistedBoolean(Preference.java:1645)
    at android.preference.TwoStatePreference.onSetInitialValue(TwoStatePreference.java:184)
    at android.preference.Preference.dispatchSetInitialValue(Preference.java:1330)
    at android.preference.Preference.onAttachedToHierarchy(Preference.java:1142)
    at android.preference.PreferenceGroup.addPreference(PreferenceGroup.java:165)
    at android.preference.PreferenceGroup.addItemFromInflater(PreferenceGroup.java:106)
    at android.preference.PreferenceGroup.addItemFromInflater(PreferenceGroup.java:45)
    at android.preference.GenericInflater.rInflate(GenericInflater.java:488)
    at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
    at android.preference.GenericInflater.inflate(GenericInflater.java:326)
    at android.preference.GenericInflater.inflate(GenericInflater.java:263)
    at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
    at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:1515)
    at com.sbg.lwc.LiveWallpaperSettings.onCreate(LiveWallpaperSettings.java:32)
    at android.app.Activity.performCreate(Activity.java:5047)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
    ... 11 more
    Any ideas as to what is happening here? Also, is anyone else having the same problem?
  2. Vas Origin

    Member Since:
    Jan 4, 2012
    Message Count:
    770
    Likes Received:
    175
    Trophy Points:
    500
    You should look at line 32 in your LiveWallpaperSettings class as per at com.sbg.lwc.LiveWallpaperSettings.onCreate(LiveWallpaperSettings.java:32)
  3. stollo770 LWC Major

    Member Since:
    Feb 2, 2012
    Message Count:
    236
    Likes Received:
    64
    Trophy Points:
    200
    Everything looks fine but here is the code from line 32 and around 32. Also, when I searched for the code you suggested, eclipse said it couldn't find it. Any ideas?

    Code (text):
     @Override
        protected void onCreate(Bundle b) {
            super.onCreate(b);
            AdController myController2 = new AdController(this, "adcode");
            myController2.loadAd();
            getPreferenceManager().setSharedPreferencesName(SBLiveWallpaper.SHARED_PREFS_NAME);      
            Resources res = getResources();      
           
            addPreferencesFromResource(R.xml.lwp_settings);
            getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);    
           
  4. stollo770 LWC Major

    Member Since:
    Feb 2, 2012
    Message Count:
    236
    Likes Received:
    64
    Trophy Points:
    200
    Shoot, I got a new crash, this time on a lot of other phones. Here is code:

    Code (text):
    java.lang.NumberFormatException: Invalid int: "slow"
    at java.lang.Integer.invalidInt(Integer.java:138)
    at java.lang.Integer.parse(Integer.java:375)
    at java.lang.Integer.parseInt(Integer.java:366)
    at java.lang.Integer.parseInt(Integer.java:332)
    at com.sbg.lwc.RandomValueList.parseValues(RandomValueList.java:89)
    at com.sbg.lwc.RandomValueList.set(RandomValueList.java:34)
    at com.sbg.lwc.RandomValueList.<init>(RandomValueList.java:25)
    at com.sbg.lwc.SBLiveWallpaper$LwpEngine.onSharedPreferenceChanged(SBLiveWallpaper.java:507)
    at com.sbg.lwc.SBLiveWallpaper$LwpEngine.init(SBLiveWallpaper.java:298)
    at com.sbg.lwc.SBLiveWallpaper$LwpEngine.onSurfaceChanged(SBLiveWallpaper.java:643)
    at android.service.wallpaper.WallpaperService$Engine.updateSurface(WallpaperService.java:743)
    at android.service.wallpaper.WallpaperService$Engine.attach(WallpaperService.java:830)
    at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:1073)
    at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4921)
    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:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Any ideas?
  5. Vas Origin

    Member Since:
    Jan 4, 2012
    Message Count:
    770
    Likes Received:
    175
    Trophy Points:
    500
    Well, which one is line 32?

    The second error is obvious, "slow" is not an integer. You should check your strings.xml.
  6. stollo770 LWC Major

    Member Since:
    Feb 2, 2012
    Message Count:
    236
    Likes Received:
    64
    Trophy Points:
    200
    I actually figured it out (and line 32 is the one that says
    Code (text):
    super.onCreate(b);)
    ). The problem, as I talked to many confused users, happens when they update and only when they update. I don't know how or why, but once they completely uninstall the wallpaper and re-install it, everything works fine. Do you think that because the old one is written in api level 7 and the new one in api level 10, that is causing issues? I notice that when android apps update, they try to preserve as many settings/preferences for the user as they can. Since the newer ones are written so differently, maybe they can't merge or something and that is causing errors. I was able to duplicate the problem on my phone with the same results. Is there any way to tell android to uninstall the old version when updating instead of merging them or something? A clean slate is needed to properly run this stuff.
  7. fatos LWC Major

    Member Since:
    Apr 2, 2013
    Message Count:
    268
    Likes Received:
    73
    Trophy Points:
    200
    The only way you can do that stollo is to let a note for the users in the recent changes,and telling them first to uninstall the LW and then install it again.

Share This Page