Git Product home page Git Product logo

kotlin-explorer's Introduction

Kotlin Explorer

Kotlin Explorer is a desktop tool to quickly and easily disassemble Kotlin code into:

  • Android DEX bytecode
  • Android OAT assembly

After launching Kotlin Explorer, type valid Kotlin code in the left pane, then click Compilation > Compile & Disassemble or use Cmd-Shift-D on macOS, Ctrl-Shift-D on Linux and Windows.

The middle pane will show the Android DEX bytecode, and the right panel the native assembly resulting from ahead of time compilation (AOT).

./art/kotlin-explorer.png

Running Kotlin Explorer

Kotlin Explorer needs to be told where to find the Android SDK and the Kotlin compiler. Unless you've set $ANDROID_HOME and $KOTLIN_HOME properly, Kotlin Explorer will ask you to enter the path to those directories.

For $ANDROID_HOME, use the path to the root of the Android SDK (directory containing build-tools/, platform-tools/, etc.). Android Studio for macOS stores this in $HOME/Library/Android/sdk.

For $KOTLIN_HOME, use the path to the root of your Kotlin installation. This directory should contain bin/kotlinc and lib/kotlin-stdlib-*.jar for instance.

Kotlin explorer also requires java and javap to be in your $PATH.

Important

DEX bytecode and OAT assembly will only be displayed if you have an Android device or emulator that can be successfully reached via adb. The device must be recent enough to host the oatdump tool on its system image.

License

Please see LICENSE.

kotlin-explorer's People

Contributors

alonalbert avatar epicdima avatar goooler avatar mhansen avatar omico avatar porum avatar romainguy avatar yasserdbeis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kotlin-explorer's Issues

[Windows] No matching toolchains found for requested specification

JAVA_HOME、ANDROID_HOME、KOTLIN_HOME is configed
image

BUT when runRelease error:

gradlew.bat runRelease

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':compileKotlinJvm'.
> No matching toolchains found for requested specification: {languageVersion=17, vendor=JETBRAINS, implementation=vendor-specific} for WINDOWS on x86_64.
   > No locally installed toolchains match and toolchain download repositories have not been configured.

* Try:
> Learn more about toolchain auto-detection at https://docs.gradle.org/8.5/userguide/toolchains.html#sec:auto_detection.
> Learn more about toolchain repositories at https://docs.gradle.org/8.5/userguide/toolchains.html#sub:download_repositories.
> Run with --stacktrace option to get the stack trace.

Getting started: should we call "Decompile" "Compile"?

Hi, just logging an experience report. As before, I'm keen to get the rest of my team using this, but I encountered a little confusion getting started, so I thought it might be worth sharing this speed bump.

I started Kotlin Explorer and wasn't sure what to do. I found in the macOS menu there was a "Decompile" option. At first, I thought this meant that I'd paste in some Assembly or dex and it'd turn it back into Kotlin? Like IntelliJ's decompiler which turns dex into java: https://www.jetbrains.com/help/idea/decompiler.html. I saw that the text field is editable for the assembly. Because compilation is normally from a higher-level language to a lower-level language, and decompilation vice-versa.

Now I suppose that printing assembly to text counts as a (slightly) higher level language than machine code!

Took me a bit of thinking to realise that it means, well, compile the kotlin to dex, decompile the dex to text, compile the dex to machine code, decompile the machine code to assembly.

I understand it now. But I propose that it might be easier for newbies to understand if we called this 'Compile' rather than 'Decompile'?

Hard to find ANDROID_HOME and KOTLIN_HOME; README.md could make this easier

Hi, love the tool. Want my team to use it! I had a bit of trouble figuring out the environment variables to set when running it; was a bit of trial-and error, so I thought I'd log an experience report about how it was to get started, and we could discuss how to make it easier.

My guess is most developers will have android sdk and kotlinc from Android Studio, so we could make setup easier by saying where Android Studio stores these?

README says:

For $ANDROID_HOME, use the path to the root of the Android SDK (directory containing
build-tools/, platform-tools/, etc.).

OK, this wasn't too hard to find, I think I knew already this was in ~/Library on my mac, but I still first tried ~/Library/Android before ~/Library/Androi/sdk worked. After a little trial and error, I got it.

For $KOTLIN_HOME, use the path to the root of your Kotlin installation. This directory
should contain bin/kotlinc and lib/kotlin-stdlib-*.jar for instance.

OK this one stumped me! First I thought, I might not have a Kotlin installation? So I went to the Kotlin website looking for a release, but I couldn't easily find one: they just say to use IntelliJ or Android Studio: https://kotlinlang.org/docs/getting-started.html#install-kotlin (edit: later on, I was able to find CLI releases: https://kotlinlang.org/docs/command-line.html).

Ultimately I got it working by setting /Applications/Android\ Studio.app/Contents/plugins/Kotlin/kotlinc/ as my KOTLIN_HOME, but that gave me an error that kotlinc was not executable, so I had to chmod +x kotlinc /Applications/Android Studio.app/Contents/plugins/Kotlin/kotlinc/bin/kotlinc, then compiling in Kotlin Explorer worked.

Now, the presence of the hacky chmod makes me think I'm not doing this right. Probably I should have installed kotlin following the instructions at https://kotlinlang.org/docs/command-line.html instead. So maybe let's link there from the README?

Thanks, and I'm keen to help. I'll send a PR with some ideas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.