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 in ApptentiveViewActivity.onSaveInstanceState #189

Open
ghost opened this issue Oct 14, 2019 · 23 comments
Open

Crash in ApptentiveViewActivity.onSaveInstanceState #189

ghost opened this issue Oct 14, 2019 · 23 comments
Assignees

Comments

@ghost
Copy link

ghost commented Oct 14, 2019

Hi, I do get the following crash report

I assume this can happen when something else crashes in onCreate before addFragmentToAdapter() is called. The generic catch should be removed there to find the real issue. A null check in onSaveInstance state could be a quick fix.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.apptentive.android.sdk.adapter.ApptentiveViewPagerAdapter.getFragmentTag(int)' on a null object reference
at com.apptentive.android.sdk.ApptentiveViewActivity.onSaveInstanceState(ApptentiveViewActivity.java:300)
at android.app.Activity.performSaveInstanceState(Activity.java:1557)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1465)
at android.app.ActivityThread.callActivityOnSaveInstanceState(ActivityThread.java:5046)
at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4359)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4341)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4416)
at android.app.servertransaction.StopActivityItem.execute(StopActivityItem.java:41)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1977)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6936)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)

Edit: version is 5.3.1

@weeeBox
Copy link
Contributor

weeeBox commented Oct 14, 2019

Hey @TheDoorNextBoy,

Sorry for the issue: we'll take a look at it asap.

@CaseyApptentive
Copy link

@TheDoorNextBoy thanks for the report! We're digging in.

In the meantime, could you email us at [email protected] with which the account you're working on? I'd like to keep your Customer Success Manager in the loop so they can help coordinate, if need be.

Thanks again.

@twinklesharma1311
Copy link
Contributor

Hey @TheDoorNextBoy , can you please let me know the steps that lead to this crash? I am trying to reproduce the same scenario in order to debug the real issue.

@weeeBox
Copy link
Contributor

weeeBox commented Oct 14, 2019

@TheDoorNextBoy, did you get the crash log from the crash reporting tool or were you able to reproduce it locally? Do you have any other logs on top of the crash log?

@ghost
Copy link
Author

ghost commented Oct 15, 2019

Hi there, thanks for your fast response!
@twinklesharma1311 , @weeeBox I can't reproduce it locally, but it's our number 1 crash on Firebase Crashlytics. I will send you the account details to your support address. Maybe you can see more in your own logs.

@ghost
Copy link
Author

ghost commented Oct 15, 2019

I sent a message to [email protected] earlier and got the following back

We recently received a message from you but were unable to find the associated record. Your message was not added to Apptentive.

Could you check that or give me another email address?
Thx

@CaseyApptentive
Copy link

@TheDoorNextBoy very sorry about the issue using [email protected] -- I'm looking into it.

Can you email me directly at [email protected]?

@ghost
Copy link

ghost commented Oct 16, 2019

I am also facing the same crash. Using the SDK version 5.4.1
Before the crash my screen freezes with a black screen and logs show the following error:

E/Apptentive: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.apptentive.android.sdk.ApptentiveViewActivity.onCreate(ApptentiveViewActivity.java:143)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.apptentive.android.sdk.ApptentiveViewActivity.onCreate(ApptentiveViewActivity.java:143) 
at android.app.Activity.performCreate(Activity.java:6876) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.apptentive.android.sdk.ApptentiveViewActivity.onCreate(ApptentiveViewActivity.java:143) 
at android.app.Activity.performCreate(Activity.java:6876) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010148 a=3}
at android.content.res.TypedArray.getDrawable(TypedArray.java:883)
at android.view.View.(View.java:4225)
at android.view.ViewGroup.(ViewGroup.java:589)
at android.view.ViewGroup.(ViewGroup.java:585)
at android.support.v7.widget.Toolbar.(Toolbar.java:233)
at android.support.v7.widget.Toolbar.(Toolbar.java:229)
at java.lang.reflect.Constructor.newInstance(Native Method) 
at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.apptentive.android.sdk.ApptentiveViewActivity.onCreate(ApptentiveViewActivity.java:143) 
at android.app.Activity.performCreate(Activity.java:6876) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

And then after home option pressed App crashes with following logs:

E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.apptentive.android.sdk.adapter.ApptentiveViewPagerAdapter.getFragmentTag(int)' on a null object reference
at com.apptentive.android.sdk.ApptentiveViewActivity.onSaveInstanceState(ApptentiveViewActivity.java:302)
at android.app.Activity.performSaveInstanceState(Activity.java:1474)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1317)
at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:5398)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4700)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4774)
at android.app.ActivityThread.access$1400(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1824)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

@weeeBox
Copy link
Contributor

weeeBox commented Oct 16, 2019

Hey @prashantbankar,

Could you share the contents of your build.gradle file and your app theme?

@CaseyApptentive
Copy link

@TheDoorNextBoy could you share the contents of your build.gradle file and your app theme as well?

Thanks!

@ghost
Copy link

ghost commented Oct 17, 2019

@weeeBox

app theme
Theme.AppCompat.Light.NoActionBar

build.gradle
buildToolsVersion '28.0.0'
compileSdkVersion 28
targetSdkVersion 28
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'

@weeeBox
Copy link
Contributor

weeeBox commented Oct 17, 2019

Thanks @prashantbankar,

Do you also have any reproduction steps?

@ghost
Copy link

ghost commented Oct 17, 2019

@weeeBox
I am firing up the event

Apptentive.engage(baseContext, event);

then calling startActivity()

I tried the troubleshoot but it didn't help

EDIT: the following log was printed though: I/Apptentive: Launching interaction: EnjoymentDialog

@ghost
Copy link

ghost commented Oct 22, 2019

@weeeBox Any update on this?

@weeeBox
Copy link
Contributor

weeeBox commented Oct 22, 2019

@prashantbankar, we're trying to reproduce the issue on our end. We have a fix ready but really want to figure out the underlying cause of the inflating exception.

@weeeBox
Copy link
Contributor

weeeBox commented Oct 22, 2019

@prashantbankar, what Gradle plugin version do you use?

@ghost
Copy link

ghost commented Oct 23, 2019

@weeeBox Gradle Plugin version 3.0.1 and Gradle version 4.1

@CaseyApptentive
Copy link

Thanks, @prashantbankar ! We're digging into this.

@CaseyApptentive
Copy link

@TheDoorNextBoy and @prashantbankar. We've released SDK version 5.4.7 with a fix for this crash. Can you update and let me know if you're still having any issues?

Thanks!

@ghost
Copy link
Author

ghost commented Oct 25, 2019

@CaseyApptentive Thanks for your fast response, But I am really disappointed about your "fix".

		} catch (Exception e) {
-			ApptentiveLog.e(e, "Exception in %s.onCreate()", ApptentiveViewActivity.class.getSimpleName());
+			ApptentiveLog.e(e, "Exception in %s.onCreate(). Finishing activity...", ApptentiveViewActivity.class.getSimpleName());
			logException(e);
+			finish();
		}

Just catching everything and finishing can not be a solution.
I'd rather have the App crash and know about it than having unexpected behaviour and bad reviews.
I understand that there is maybe not enough information at the moment to properly fix it. But if you would not use those generic catches I could have sent you better logs in the first place.

Please let me know if you plan another update.
Thanks

@weeeBox
Copy link
Contributor

weeeBox commented Oct 25, 2019

@TheDoorNextBoy, we understand your frustration but cannot reproduce the bug on any configuration (Gradle Plugin/Wrapper version, legacy Android Studio, different app themes). We released a fix to prevent devices from crashing and continued investigating. There will be no unexpected behaviour: if the problem persists - the users won't be able to see Love Dialog.
It would be really helpful if you can provide the content of your app and project level build.gradle files (we need to know your dependencies and Gradle Plugin/Wrapper versions) and your styling files (what theme you use and how you configure it). Hope, this makes it more clear and sorry for the inconvenience.

@ghost
Copy link
Author

ghost commented Oct 29, 2019

Hi @weeeBox,
Sorry for my late reply. I was a bit busy the last days.
We will release a new version with 5.4.7 in a few days as soon as QA approves.

Actually our theme could really be an issue.
Our parent theme is Theme.MaterialComponents.Light.NoActionBar.Bridge from
implementation 'com.google.android.material:material:1.0.0'
Maybe you could check it. If I find some time today I'll try another one.

We are using the following androidx libraries:

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Our gradle version is gradle-5.4.1

@weeeBox
Copy link
Contributor

weeeBox commented Oct 29, 2019

Hi @TheDoorNextBoy, we need to create an app with the very same dependencies, Gradle plugin/wrapper versions and styling as your app in order for being able to reproduce the issue. Would you be able to provide these?

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

No branches or pull requests

3 participants