Skip to content

Hardcoded dex2jar version #7

@Mr-TWX

Description

@Mr-TWX

Hi @ajitsing , thanks for this Gem

Issue

I've tried to run it on MacOs and found and received the following error

user@MacBook-Pro-di-User ~ % apkToJava /Users/myuser/Desktop/base.apk
Initializing setup!!
checking for curl... yes
Installing dex2jar..
Warning: dex2jar 2.1 is already installed and up-to-date.
To reinstall 2.1, run:
  brew reinstall dex2jar
Done!
Setup done :)
Converting to dex..
Done!
Converting dex to jar..
/Users/myuser/.gem/ruby/2.6.0/gems/apkToJava-1.3.1/lib/apk_to_java.rb:53:in ``': No such file or directory - /usr/local/Cellar/dex2jar/2.0/bin/d2j-dex2jar (Errno::ENOENT)
	from /Users/myuser/.gem/ruby/2.6.0/gems/apkToJava-1.3.1/lib/apk_to_java.rb:53:in `create_jar'
	from /Users/myuser/.gem/ruby/2.6.0/gems/apkToJava-1.3.1/lib/apk_to_java.rb:82:in `dex_to_jar'
	from /Users/myuser/.gem/ruby/2.6.0/gems/apkToJava-1.3.1/lib/apk_to_java.rb:88:in `view_as_java_code'
	from /Users/myuser/.gem/ruby/2.6.0/gems/apkToJava-1.3.1/bin/apkToJava:61:in `execute'
	from /Users/myuser/.gem/ruby/2.6.0/gems/apkToJava-1.3.1/bin/apkToJava:65:in `<top (required)>'
	from /Users/myuser/gems/bin/apkToJava:23:in `load'
	from /Users/myuser/gems/bin/apkToJava:23:in `<main>'

Cause

Looking at the source code for mac_setup.rb, the DEX_TO_JARconstant is hardcoded to the 2.0 version.

Since the latest version available is 2.1, the error above is thrown.

Possible solutions

At the moment, I've managed to fix the issue by changing the mac_setup.rb file by updating the hardcoded reference from 2.0 to 2.1.

It would be nicer to have the apkToJava to automatically use the latest version of dex2jar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions