aboutcode-org / aboutcode-org/scancode.io

Android APK: support kotlin decompilation

Đang mở
#1,392 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
215
Fork
203
Merge trung bình
4 ngày 8 giờ
Pull request đã merge (30 ngày)
6

Mô tả

This is a follow from https://github.com/aboutcode-org/scancode.io/issues/1372#issuecomment-2357828400 by @chinyeungli :+1:

> This is a little sample d2d note when I compile an APK from kotlin sources
>
> I created an APK in a sample android project that have 7 sources (excluing those xml from res/) which include 6 .kt files and 1.java file.
>
> If I extract the APK, I find 5 classes.dex files, making it unclear which dex files contain the 'real' sources and which ones contain Google libraries.
>
> On the other hand, if I use JADX directly on the APK file, it generates file structure without worrying the dex files.
>
> This note indicates that we can use JADX directly on the APK file rather than the DEX file.
>
> However, in either cases, it generated many more files that we originally have in the sources.
> It generated the following directories:
> ```
> _COROUTINE/
> android/support/v4/
> andoridx/
> com/example/ <-- source location
> com/google/common/
> kotlin/
> kotlinx/
> org/intellig/
> org/jetbrains/
> ```
>
> As note above, the source location should only be in com/example/, but it generates many other libs that we need to smartly ignore/identify when we perform the D2D in a sense that these will be no match.
>
> For the file level, following are the source files in a sample andorid project:
> ```
> empty_java.java
> empty_kt.kt
> MainActivity.kt
> test_kt.kt
> ```
> Following are the decompiled files generated from jadx:
> ```
> ComposableSingletons$MainActivityKt.java
> empty_java.java
> empty_kotlin.java
> MainActivity.java
> MainActivityKt.java
> R.java
> test_kotlin.java
> Test_ktKt.java
> ```
>
> We already know all the R.java is generated, but for others, it is important to note that not all of them have matching basenames.
> These are the matching:
>
> Source: empty_java.java
> JADX: empty_java.java
>
> Source: empty_kt.kt
> JADX: empty_kotlin.java
>
> Source: MainActivity.kt
> JADX: MainActivity.java, MainActivityKt.java
>
> Source: test_kt.kt
> JADX: test_kotlin.java, Test_ktKt.java
>
>
> We need to find a pattern in order to increase the matching accuracy and avoid noise.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.