16

Recently I did migration of my application to targetSdkVersion = 28. After publishing the updated app to Google Play I started to get very strange crash reports in Fabric.io: Crash report

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'android.os.IBinder android.view.SurfaceControl.getHandle()' on a null object reference
android.os.Parcel.createException (Parcel.java:1956)
android.os.Looper.loop (Looper.java:193)
android.app.ActivityThread.main (ActivityThread.java:6718)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)

This crash occurs only on Google devices(Pixel Series) with android Pie when app is opened by user from Play Store App, when opening from home screen everything works as expected. And there is no any trace to my code in crash report.

When I disable proguard everything works as expected

vt600c
  • 181
  • 1
  • 7

4 Answers4

2

You can add this rules to you proguard-rules.pro:

-keep class android.view.**

Other than that, could you include some of your proguard configuration?

Jimly Asshiddiqy
  • 335
  • 4
  • 15
0

We had a similar exception - only crashing on Pixel devices, too:

java.lang.NullPointerException: Attempt to invoke direct method 'void android.view.SurfaceControl.checkNotReleased()' on a null object reference
    at android.os.Parcel.createException(Parcel.java:2077)
    at android.os.Parcel.readException(Parcel.java:2039)
    at android.os.Parcel.readException(Parcel.java:1987)
    at android.app.IActivityTaskManager$Stub$Proxy.activityPaused(IActivityTaskManager.java:4489)
    at android.app.servertransaction.PauseActivityItem.postExecute(PauseActivityItem.java:64)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.os.RemoteException: Remote stack trace:
    at android.view.SurfaceControl.access$800(SurfaceControl.java:77)
    at android.view.SurfaceControl$Transaction.reparent(SurfaceControl.java:2429)
    at com.android.server.wm.SurfaceAnimator.transferAnimation(SurfaceAnimator.java:238)
    at com.android.server.wm.WindowContainer.transferAnimation(WindowContainer.java:1261)
    at com.android.server.wm.AppWindowToken.transferStartingWindow(AppWindowToken.java:1575)

We raised the targetSdkVersion and compileSdkVersion from 29 to 30 and the exception did not appear anymore.

einsA
  • 797
  • 1
  • 7
  • 19
0

Update the target SDK version to 30 and upgrade the build tool version and Gradle version. Then clean and rebuild the project. If the problem is not fixed, we may need to look for more detailed log data for the application.

Eishon
  • 1,274
  • 1
  • 9
  • 17
-3

I myself was stuck in this issue for weeks until I found this

buildTypes {
        debug {
            debuggable true
            buildConfigField 'String', "GOOGLE_KEY", GOOGLE_API
            buildConfigField "boolean", "IS_DEBUG", "true"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            minifyEnabled false
            shrinkResources false
        }
        release {
            debuggable false //This needs to be "true"
            buildConfigField "boolean", "IS_DEBUG", DEBUGABLE
            buildConfigField 'String', "GOOGLE_KEY", GOOGLE_API
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-optimize.pro'
            minifyEnabled false
            proguardFile PROGUARD_FILE
            shrinkResources false
        }
    }

Just change the debuggable in release to true.

AdrianHHH
  • 13,492
  • 16
  • 50
  • 87
  • 3
    Change **debuggable** **false** to **true** in **release** build type is not what any of us want to do. – vt600c Aug 04 '19 at 17:18
  • Yes I agree it is not the solution, but it will run the app. But I fixed the app crash by calling finish on current activity after calling startActivity for second activity. You can also check for the same for the screen where crash is occurring. – Dheeraj Kanwar Aug 06 '19 at 03:12