Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[gui] Smali debugger launch app error. #2292

Closed
1 of 3 tasks
ZhanYiBai opened this issue Oct 6, 2024 · 7 comments
Closed
1 of 3 tasks

[gui] Smali debugger launch app error. #2292

ZhanYiBai opened this issue Oct 6, 2024 · 7 comments
Labels
bug GUI Issues in jadx-gui module

Comments

@ZhanYiBai
Copy link

Issue details

When I click Launch app, it tell me , can't find Main Activity Class. Then I close it , and i click button: go to main activity, the same error occurs again. so i used previous version 1.4.7, then it works.

Jadx version

1.5.0

Java version

19.0.2

OS

  • Windows
  • Linux
  • macOS
@ZhanYiBai ZhanYiBai added bug GUI Issues in jadx-gui module labels Oct 6, 2024
@jpstotz
Copy link
Collaborator

jpstotz commented Oct 6, 2024

Are you sure the MainActivity class exists in the app? Android apps don't need to have a MainActivity, e.g. apps targeting Android-TV usually have no MainActivity if they are not also targeting Android phones/tablets. Also some hidden apps don't have a MainActivity.

Can you share the APK file that doesn't work?

@AndreiKud
Copy link
Contributor

AndreiKud commented Oct 12, 2024

@jpstotz here is empty new project, jumps do not work with WARN : Cannot codeJump because selectedTab is null in logs.
app-debug.zip

UPD. Just realized topic starter said it was an error about no activity. I guess it's unrelated.

@jpstotz
Copy link
Collaborator

jpstotz commented Oct 12, 2024

@AndreiKud Indeed Jadx seems to have a problem when you execute "Go to main Activity" when there is no tab open (no class or resource file opened). Then codeJump function refuses to work and outputs the warning Cannot codeJump because selectedTab is null (tested in latest unstable version).

Do you remember if this warning was also printed when you click "Launch app"?

@skylot If I remove the selectedTab == null check in jadx.gui.ui.tab.TabsController#codeJump(jadx.gui.utils.JumpPosition) the function "Go to main Activity" works as expected even if no tab is opened. I checked all implementations of onTabCodeJump that receive selectedTab as argument but I wasn't able to find an implementation that makes use of it. Thus it seems that we can remove the selectedTab == null check.

@AndreiKud
Copy link
Contributor

AndreiKud commented Oct 12, 2024

@jpstotz just in case you addressed "launch app" to me, the topic starter is @ZhanYiBai

@skylot
Copy link
Owner

skylot commented Oct 12, 2024

If I remove the selectedTab == null check

@jpstotz correct tab events should be: open, select, code jump, so looks like instead of removing check we need to call select method (which will call open) and after that produce code jump event.
So code jump method should be like this:

	public void codeJump(JumpPosition pos) {
		if (selectedTab == null || selectedTab.getNode() != pos.getNode()) {
			selectTab(pos.getNode());
		}
		listeners.forEach(l -> l.onTabCodeJump(selectedTab, pos));
	}

Although, I agree, such event model is confusing, and I see that different methods are called just to "open tab".
This need to be simplified, but I am not sure how to do this yet 😞

@skylot
Copy link
Owner

skylot commented Oct 12, 2024

I commit mentioned changes, also I reviewed tab events and can't find a solution to reduce events amount because all of them are used and have their own purpose.
Short tab events description:

  • open - tab opened without become active (used in tabs restore methods)
  • select - tab selected by user, also used to change active tab by "quick tabs panel"
  • code jump - change cursor position in selected tab. Method with same name in TabsController provide simple way to do all work of loading and sending all needed events, this method should be used for all code navigation.

@skylot
Copy link
Owner

skylot commented Oct 12, 2024

Looks like cause of the original issue is still unknown and author not provide details to help reproduce it, so I will close it.

@skylot skylot closed this as completed Oct 12, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug GUI Issues in jadx-gui module
Projects
None yet
Development

No branches or pull requests

4 participants