Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when initializing a map #1079

Closed
StevenTB opened this issue Jul 5, 2018 · 9 comments
Closed

Crash when initializing a map #1079

StevenTB opened this issue Jul 5, 2018 · 9 comments
Labels
Milestone

Comments

@StevenTB
Copy link

StevenTB commented Jul 5, 2018

Issue Type

[X] Question
[X] Bug

Description and/or steps/code to reproduce the problem

I had a crash on a customer's phone on that line :
Configuration.getInstance().load(getApplicationContext(), PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));

But it does work fine when I am testing on Galaxy S7, Nexus 5. Here is the Fabric's stacktrace :

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{ ... }: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference

I can see that the NPE happened in the load() method in DefaultConfigurationProvider.java.

In my project, this is the line where it crashs, located in the onCreate() of my Activity, before I inflate my map:
Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this));

Environment

If it's a bug, version(s) of android this affects:

At least Sony Xperia Z3 (6.0.1) and One Plus 5 (8.1)

Version of osmdroid the issue relates to:

5.6.5

@StevenTB
Copy link
Author

StevenTB commented Jul 5, 2018

I can tell you that happened when a user did an update with an previous project without osmdroid

@cbalster
Copy link
Contributor

cbalster commented Jul 7, 2018

Can you post the full stacktrace? I suspect this is an issue in StorageUtils.

@spyhunter99
Copy link
Collaborator

second that we need the line number

@StevenTB
Copy link
Author

StevenTB commented Jul 9, 2018

@spyhunter99 @cbalster Hi, thanks for your help. Here is the Fabric stacktrace :

DefaultConfigurationProvider.java line 401
org.osmdroid.config.DefaultConfigurationProvider.load
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.xxx.view.trip.activity.MapActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2911)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6753)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference
       at org.osmdroid.config.DefaultConfigurationProvider.load(DefaultConfigurationProvider.java:401)
       at org.osmdroid.config.DefaultConfigurationProvider.load(DefaultConfigurationProvider.java:317)
       at com.drivequant.view.trip.activity.TripActivity.onCreate(TripActivity.java:111)
       at android.app.Activity.performCreate(Activity.java:7036)
       at android.app.Activity.performCreate(Activity.java:7027)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6753)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@StevenTB
Copy link
Author

Hi,

If you need more information please do not hesitate to tell me how can we help each other.

Regards,

@spyhunter99
Copy link
Collaborator

spyhunter99 commented Jul 13, 2018 via email

@spyhunter99
Copy link
Collaborator

hmm no idea why this blew up. i added some null checks to trap this in the future

@spyhunter99 spyhunter99 added this to the v6.0.2 milestone Jul 16, 2018
spyhunter99 added a commit that referenced this issue Jul 16, 2018
@StevenTB
Copy link
Author

StevenTB commented Jul 17, 2018

@spyhunter99 Thank you so much for your help. Did you plan to make a snapshot with that fix or do you have any release date for the v6.0.2 ?

Regards

@spyhunter99
Copy link
Collaborator

spyhunter99 commented Jul 18, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants