skylot / jadx

Dex to Java decompiler
Apache License 2.0
40.98k stars 4.81k forks source link

ui font and icons are crazy tiny on windows 10 #752

Closed steelbytes closed 4 years ago

steelbytes commented 4 years ago

using the jre that is bundled with android studio 3.5 on windows 10 with a hidpi monitor the ui is ridiculously tiny and hence unusable.

jpstotz commented 4 years ago

The Java Runtime that comes with Android Studio is Java 8. I don't have any experience with Java and high dpi monitors, but from what I have read about it newer Java versions seem to behave better on high dpi monitors. Therefore could you please test to use Java 11 instead (e.g. the installation package provided by AdoptOpenJDK)?

BTW: Which exact Windows version do you use? 1903, 1809 or 1803?

steelbytes commented 4 years ago

ver 1903 and mixing and matching different java runtimes aint something I really want to try ... not to mention the security issues with maintaing multiple installations

skylot commented 4 years ago

I agree with @jpstotz, in java versions from 9 you can add to java options "-Dsun.java2d.uiScale=2". This must be added in jadx-gui.bat to end of DEFAULT_JVM_OPTS like this:

set DEFAULT_JVM_OPTS="-Xms128M" "-Xmx4g" "-Dawt.useSystemAAFontSettings=lcd" "-Dswing.aatext=true" "-XX:+UseG1GC" "-Dsun.java2d.uiScale=2"

@steelbytes if you don't want to install another java version you can try jadx-gui-1.0.0-with-jre-windows.zip bundle which comes with java 11.

steelbytes commented 4 years ago

@skylot sadly using the download with bundled jre is even worse. although the font size is better, the ui doesn't work: cant see java code when I click on a class in the tree, cant open the class or text search, cant open log viewer, .... completly broken.

yet all these ui things work with the other download but just have scaling issues

jpstotz commented 4 years ago

@skylot Indeed this version does not work correctly just as steelbytes describes. @steelbytes You can simply download Java 11 from AdoptOpenJDK and use the regular Jadx version. Regarding the Java security updates the situation is not as bad as it may look at a first glance, as long as you only use Java for desktop applications. Most of the discovered vulnerabilities lately in Java apply only if you use Java in an Applet, WebStart or J2EE server environment. Applets and WebStart are no longer available in Java 11, therefore those vulnerabilities are no longer relevant.

skylot commented 4 years ago

I fix JRE bundle, looks like some java modules were missing, new bundle: jadx-gui-1.0.0-2-with-jre-windows.zip

steelbytes commented 4 years ago

@skylot still doesn't work :-(

jpstotz commented 4 years ago

@skylot jadx-gui-1.0.0-2-with-jre-windows.zip fails because it fails to load it's settings:

ERROR - Error load settings
java.lang.RuntimeException: Unable to invoke no-args constructor for class jadx.gui.settings.WindowLocation. Registering an InstanceCreator with Gson for this type may fix this problem.
        at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:228)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.Gson.fromJson(Gson.java:927)
        at com.google.gson.Gson.fromJson(Gson.java:892)
        at com.google.gson.Gson.fromJson(Gson.java:841)
        at com.google.gson.Gson.fromJson(Gson.java:813)
        at jadx.gui.settings.JadxSettingsAdapter.fromString(JadxSettingsAdapter.java:88)
        at jadx.gui.settings.JadxSettingsAdapter.load(JadxSettingsAdapter.java:59)
        at jadx.gui.JadxGUI.main(JadxGUI.java:20)
Caused by: java.lang.UnsupportedOperationException: Cannot allocate class jadx.gui.settings.WindowLocation
        at com.google.gson.internal.UnsafeAllocator$4.newInstance(UnsafeAllocator.java:104)
        at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:225)
        ... 13 common frames omitted

In the end this results in a NullPointerException with nearly every Jadx gui function:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at jadx.gui.ui.codearea.AbstractCodeArea.loadCommonSettings(AbstractCodeArea.java:105)
        at jadx.gui.ui.codearea.CodeArea.getDefaultArea(CodeArea.java:112)
skylot commented 4 years ago

Another try: jadx-gui-1.0.0-3-with-jre-windows.zip. This time I change code to add default constructors to classes serialized with GSON (check jre-bundle branch).

steelbytes commented 4 years ago

@skylot much better, thank you :-)

now if only I can get fixes for some decompiler errors (see other recent git issues opened and commented on by me) .....

rekire commented 4 years ago

Can we reopen this? It still doesn't work with Java 1.8, but with Java 11 it works.

steelbytes commented 4 years ago

@rekire are you using the download with the bundled jre?

rekire commented 4 years ago

No the classic one, with the batch files

jpstotz commented 4 years ago

Java 1.8 has no high-dpi support and most likely will never have. Therefore your problems are not unexpected.

You have to use Java 11. The simplest way is to use the Jadx version with integrated JRE.