I have a Service that acts like an overlay with a chathead (like facebook messenger) when the user tap on this chatHead I pop a MapView (v2)
It works for the majority of my users, but in the bug report all the Xiaomi Xiaomi Redmi Note 3 users have the same crash
java.lang.RuntimeException: Unable to create service com.package.MyService: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object reference at android.app.ActivityThread.handleCreateService(ActivityThread.java) at android.app.ActivityThread.access$1800(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java) at android.os.Handler.dispatchMessage(Handler.java) at android.os.Looper.loop(Looper.java) at android.app.ActivityThread.main(ActivityThread.java) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object reference at android.view.SurfaceView.init(SurfaceView.java) at android.view.SurfaceView.(SurfaceView.java) at maps.V.x.(Unknown Source) at maps.V.v.(Unknown Source) at maps.D.v.(Unknown Source) at maps.D.v.a(Unknown Source) at maps.ad.ae.a(Unknown Source) at maps.ad.u.a(Unknown Source) at maps.ad.R.a(Unknown Source) at wc.onTransact(:com.google.android.gms.DynamiteModulesB:66) at android.os.Binder.transact(Binder.java) at com.google.android.gms.maps.a.e$a$a.a(Unknown Source) at com.google.android.gms.maps.MapView$a.a(Unknown Source) at com.google.android.gms.dynamic.e.a(Unknown Source) at com.google.android.gms.dynamic.c.a(Unknown Source) at com.google.android.gms.maps.MapView$b.g(Unknown Source) at com.google.android.gms.maps.MapView$b.a(Unknown Source) at com.google.android.gms.dynamic.b.a(Unknown Source) at com.google.android.gms.dynamic.b.a(Unknown Source) at com.google.android.gms.maps.MapView.a(Unknown Source)
The code that seems to fail is here
this.setTheme(R.style.AppTheme); this.myView = LayoutInflater.from(this).inflate(R.layout.my_map, null); this.mapView = (MapView) myView.findViewById(R.id.map); this.mapView.onCreate(null); this.mapView.getMapAsync(this);
The line that throws this error is
this.mapView.getMapAsync(this);
Anyone have a solution for this?