element-android icon indicating copy to clipboard operation
element-android copied to clipboard

Crash when opening chatroom

Open opk12 opened this issue 10 months ago • 8 comments

Steps to reproduce

  1. Open the app.
  2. Open a chatroom.

Outcome

The app crashes.

FATAL EXCEPTION: main
Process: im.vector.app, PID: 752
java.lang.RuntimeException: Unable to start activity ComponentInfo{im.vector.app/im.vector.app.features.home.room.detail.RoomDetailActivity}: android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class im.vector.app.features.home.room.detail.composer.RichTextComposerLayout
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3003)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3064)
	at android.app.ActivityThread.-wrap14(ActivityThread.java)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6816)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class im.vector.app.features.home.room.detail.composer.RichTextComposerLayout
Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class im.vector.app.features.home.room.detail.composer.RichTextComposerLayout
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Constructor.newInstance0(Native Method)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
	at android.view.LayoutInflater.createView(LayoutInflater.java:652)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
	at im.vector.app.databinding.FragmentComposerBinding.inflate(SourceFile:2)
	at im.vector.app.features.home.room.detail.composer.MessageComposerFragment.getBinding(SourceFile:2)
	at im.vector.app.features.home.room.detail.composer.MessageComposerFragment.getBinding(SourceFile:1)
	at im.vector.app.core.platform.VectorBaseFragment.onCreateView(SourceFile:28)
	at androidx.fragment.app.Fragment.performCreateView(SourceFile:25)
    at androidx.fragment.app.FragmentStateManager.createView(SourceFile:200)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(SourceFile:125)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(SourceFile:350)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(SourceFile:82)
    at androidx.fragment.app.FragmentManager.execPendingActions(SourceFile:22)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(SourceFile:41)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(SourceFile:2)
    at androidx.fragment.app.Fragment.performViewCreated(SourceFile:20)
    at androidx.fragment.app.FragmentStateManager.createView(SourceFile:302)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(SourceFile:125)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(SourceFile:350)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(SourceFile:82)
    at androidx.fragment.app.FragmentManager.execPendingActions(SourceFile:22)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(SourceFile:41)
    at androidx.fragment.app.FragmentManager.dispatchActivityCreated(SourceFile:11)
    at androidx.fragment.app.FragmentController.dispatchActivityCreated(SourceFile:5)
    at androidx.fragment.app.FragmentActivity.onStart(SourceFile:21)
    at androidx.appcompat.app.AppCompatActivity.onStart(SourceFile:1)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
    at android.app.Activity.performStart(Activity.java:6994)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2956)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3064)
    at android.app.ActivityThread.-wrap14(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6816)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: android.view.InflateException: Binary XML file line #134: Binary XML file line #134: Error inflating class io.element.android.wysiwyg.EditorEditText
Caused by: android.view.InflateException: Binary XML file line #134: Error inflating class io.element.android.wysiwyg.EditorEditText
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
    at android.view.LayoutInflater.createView(LayoutInflater.java:652)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
    at android.view.View.inflate(View.java:22521)
    at im.vector.app.features.home.room.detail.composer.RichTextComposerLayout.<init>(SourceFile:8)
    at im.vector.app.features.home.room.detail.composer.RichTextComposerLayout.<init>(SourceFile:3)
    at im.vector.app.features.home.room.detail.composer.RichTextComposerLayout.<init>(SourceFile:2)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
    at android.view.LayoutInflater.createView(LayoutInflater.java:652)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
    at im.vector.app.databinding.FragmentComposerBinding.inflate(SourceFile:2)
    at im.vector.app.features.home.room.detail.composer.MessageComposerFragment.getBinding(SourceFile:2)
    at im.vector.app.features.home.room.detail.composer.MessageComposerFragment.getBinding(SourceFile:1)
    at im.vector.app.core.platform.VectorBaseFragment.onCreateView(SourceFile:28)
    at androidx.fragment.app.Fragment.performCreateView(SourceFile:25)
    at androidx.fragment.app.FragmentStateManager.createView(SourceFile:200)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(SourceFile:125)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(SourceFile:350)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(SourceFile:82)
    at androidx.fragment.app.FragmentManager.execPendingActions(SourceFile:22)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(SourceFile:41)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(SourceFile:2)
    at androidx.fragment.app.Fragment.performViewCreated(SourceFile:20)
    at androidx.fragment.app.FragmentStateManager.createView(SourceFile:302)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(SourceFile:125)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(SourceFile:350)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(SourceFile:82)
    at androidx.fragment.app.FragmentManager.execPendingActions(SourceFile:22)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(SourceFile:41)
    at androidx.fragment.app.FragmentManager.dispatchActivityCreated(SourceFile:11)
    at androidx.fragment.app.FragmentController.dispatchActivityCreated(SourceFile:5)
    at androidx.fragment.app.FragmentActivity.onStart(SourceFile:21)
    at androidx.appcompat.app.AppCompatActivity.onStart(SourceFile:1)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
    at android.app.Activity.performStart(Activity.java:6994)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2956)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3064)
    at android.app.ActivityThread.-wrap14(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6816)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar)
    at androidx.emoji2.text.flatbuffer.Utf8Old$$ExternalSyntheticApiModelOutline0.m(SourceFile:1)
    at org.jsoup.internal.StringUtil.<clinit>(SourceFile:78)
    at org.jsoup.internal.StringUtil.inSorted(SourceFile:1)
    at org.jsoup.parser.HtmlTreeBuilder.onStackNot(SourceFile:32)
    at org.jsoup.parser.HtmlTreeBuilderState$7.process(SourceFile:31)
    at org.jsoup.parser.HtmlTreeBuilder.process(SourceFile:2)
    at org.jsoup.parser.TreeBuilder.stepParser(SourceFile:35)
    at org.jsoup.parser.TreeBuilder.runParser(SourceFile:1)
    at org.jsoup.parser.TreeBuilder.parseFragment(SourceFile:12)
    at org.jsoup.parser.Parser.parseFragment(SourceFile:2)
    at org.jsoup.parser.Parser.parseBodyFragment(SourceFile:9)
    at org.jsoup.Jsoup.clean(SourceFile:5)
    at io.element.android.wysiwyg.utils.HtmlToSpansParser.convert(SourceFile:19)
    at io.element.android.wysiwyg.internal.utils.AndroidHtmlConverter.fromHtmlToSpans(SourceFile:14)
    at io.element.android.wysiwyg.internal.viewmodel.EditorViewModel.stringToSpans(SourceFile:5)
    at io.element.android.wysiwyg.internal.viewmodel.EditorViewModel.rerender(SourceFile:5)
    at io.element.android.wysiwyg.EditorEditText.rerender(SourceFile:21)
    at io.element.android.wysiwyg.EditorEditText.updateStyle(SourceFile:89)
    at io.element.android.wysiwyg.EditorEditText.<init>(SourceFile:17)
    ... 60 more

Your phone model

Samsung

Operating system version

Android 7.1.1

Application version and app store

1.6.30 from F-droid crashes. Instead, 1.6.24 from F-droid was working.

Homeserver

matrix.org

Will you send logs?

No

Are you willing to provide a PR?

No

opk12 avatar Feb 12 '25 08:02 opk12

Is this possibly the same issue we already head in 2021? See https://github.com/element-hq/element-android/issues/3897 I think the solution at that time was the PR https://github.com/element-hq/element-android/pull/3903 right?

penguin-ff avatar Feb 17 '25 17:02 penguin-ff

Element from F-Droid started to crash while opening a chatroom on Android 5.1 after updating to 1.6.30. Downgrading to 1.6.28 is a workaround for now.

andreygursky avatar Feb 19 '25 21:02 andreygursky

I can confirm that the f-droid version 1.6.30 and the play store version 1.6.32 cause the crash. I can confirm that the f-droid version 1.6.28 works as a workaround.

I run Element on a phone with Android 6.

github-kp avatar Mar 10 '25 00:03 github-kp

Does not crash on Samsung Android 11 the version 1.6.30 from F-droid.

opk12 avatar Mar 12 '25 19:03 opk12

Hi. Okay, thank you. @yostyle describes in https://github.com/element-hq/element-android/issues/9010 that this crash happens on Android 7 and below. I can confirm that Element (>= 1.6.30) is crashing on Android 6, while there are no problems on Android 8.

github-kp avatar Mar 12 '25 22:03 github-kp

I can confirm the that the f-droid versions 1.6.30, 1.6.32 and 1.6.34 cause the crash. I can confirm that the f-droid version 1.6.28 (from f-droid archive) works as a workaround.

I run Element on a phone with Android 7.1.2.

I'd like to see this issue fixed so that I can follow last versions of Element.

oupala avatar May 19 '25 00:05 oupala

Hello, this issue is similar to https://github.com/jhy/jsoup/issues/2123, which states that desugaring for low version of Android devices is needed. My Android 7.1.2 derived device reported on withInitial(), too, but I cannot actually build a problem-invoking app in my development environment, so this fix is sadly not testable on my machine. I think I'm using a jbr-21 java version, but I'm not sure if that is relevant to the build difference.

iscas-zac avatar Jun 04 '25 10:06 iscas-zac

Still an issue on today's release 1.6.42 from F-droid.

opk12 avatar Jun 27 '25 07:06 opk12