termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
1.85k stars 290 forks source link

[Bug]: Exception: Only one Looper may be created per thread #553

Closed vank4o closed 6 months ago

vank4o commented 6 months ago

Problem description

When I run termux-x11 in termux, the command immediately exits with java.lang.ExceptionInInitializerError at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:536) at com.termux.x11.Loader.main(Loader.java:24) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:398) Caused by: java.lang.RuntimeException: Only one Looper may be created per thread at android.os.Looper.prepare(Looper.java:116) at android.os.Looper.prepareMainLooper(Looper.java:130) at com.termux.x11.CmdEntryPoint.(CmdEntryPoint.java:221) ... 5 more

Running with TERMUX_X11_DEBUG=1 doesn't provide any additional information

Screenshot_20240208_195018

What steps will reproduce the bug?

Run the command termux-x11 on the command prompt

What is the expected behavior?

Successfully start termux-x11

twaik commented 6 months ago

Where exactly did you get apk and deb?

twaik commented 6 months ago

@vank4o ?

vank4o commented 6 months ago

I've got it from Build Actions(latest)

twaik commented 6 months ago

I am asking about both .apk and .deb packages. I tried installing both from the last action a minute ago and it works.

The problem you mentioned can happen only if you use old outdated .deb with new .apk. Period.

Duplicate of #551.

vank4o commented 6 months ago

No, it's definitely not done! I've installed termux-x11-nightly-1.03.00-0-all.deb as well as the universal apk from the same build on my Honor phone and on my lenovo tablet. On my tablet it works, on my phone it exits with the Exception. How is this possible?! Both are on android 13.

Screenshot_20240208-210745

twaik commented 6 months ago

Try that one. https://github.com/termux/termux-x11/actions/runs/7835283475

I have no idea why this line causes exception even with guarding expression. This build explicitly ignores it.

twaik commented 6 months ago

@vank4o does it work?

twaik commented 6 months ago

@vank4o ?

vank4o commented 6 months ago

Try that one. https://github.com/termux/termux-x11/actions/runs/7835283475

I have no idea why this line causes exception even with guarding expression. This build explicitly ignores it.

Hello Twaik,

Sorry I just saw your reply. I could test it and it works just like on my tablet. Thank you very much!

Yesterday I tared my entire termux setup from the lenovo tablet, I dumped the apks for termux and termux-x11 and transferred them to the Honor phone, but I still got the exception. Maybe it's something with the Kernel or some libs on this particular phone... Maybe because it is a foldable. I don't know. Thank you again!

twaik commented 6 months ago

Do you get exception with the apk from latest artifact? This new version simply ignores this exception so it should work.

twaik commented 6 months ago

@vank4o ?

vank4o commented 5 months ago

Hello twaik,

yes, it does work, I don't get any exceptions. Thank you!