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

[gui] ADB debugging is not available in flatpak version #2214

Open
1 of 3 tasks
JustAnyones opened this issue Jul 8, 2024 · 0 comments
Open
1 of 3 tasks

[gui] ADB debugging is not available in flatpak version #2214

JustAnyones opened this issue Jul 8, 2024 · 0 comments
Labels
bug GUI Issues in jadx-gui module

Comments

@JustAnyones
Copy link

Issue details

In the flatpak version of the program you are not able to specify ADB path for debugging a process. That is because flatpak is sandboxed and doesn't have access to the ADB binary.

One potential solution could be to include the binary together with the program in the flatpak.

Alternatively, one could use system installation of ADB by passing the following command: /bin/flatpak-spawn --host adb. That would require access to org.freedesktop.Flatpak D-Bus interface. More on that here: https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-spawn

I actually tried to do the latter by supplying that command in the dialog's ADB path field, however due to how the argument gets parsed in the code, it fails with the following exception:

ERROR - Failed to start adb server
java.io.IOException: Cannot run program "/bin/flatpak-spawn --host adb": error=2, No such file or directory
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
        at jadx.gui.device.protocol.ADB.startServer(ADB.java:157)
        at jadx.gui.ui.dialog.ADBDialog.startADBServer(ADBDialog.java:247)
        at jadx.gui.ui.dialog.ADBDialog.lambda$initUI$3(ADBDialog.java:177)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
        at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
        at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
        at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
        at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
        at java.desktop/java.awt.Component.processEvent(Component.java:6391)
        at java.desktop/java.awt.Container.processEvent(Container.java:2266)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
        at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.io.IOException: error=2, No such file or directory
        at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
        ... 39 common frames omitted

If you want to test the spawn command, you can enter the flatpak debug shell:

flatpak run --command=sh com.github.skylot.jadx

And inside the shell run:

/bin/flatpak-spawn --host adb version

Assuming you have adb installed on your system, it should return something like

Android Debug Bridge version 1.0.41
Version 35.0.1-android-tools
Installed as /usr/bin/adb
Running on Linux 6.9.7-arch1-1 (x86_64)

I would like to hear your thoughts on the matter.

Jadx version

1.5.0

Java version

17.0.11

OS

  • Windows
  • Linux
  • macOS
@JustAnyones JustAnyones added bug GUI Issues in jadx-gui module labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug GUI Issues in jadx-gui module
Projects
None yet
Development

No branches or pull requests

1 participant