google / android-classyshark

Android and Java bytecode viewer
Apache License 2.0
7.5k stars 875 forks source link

Suggestion: Have a look at "apk-parser" library #181

Open AndroidDeveloperLB opened 4 years ago

AndroidDeveloperLB commented 4 years ago

It offers various things that are missing here, and vice versa:

https://github.com/hsiafan/apk-parser

It would be great to have a single library that has both of what those libraries offer.

We could, this way, get resources data properly, maybe even parse more...

kmadsen commented 3 years ago

Came here for this issue. Is this the apk-parser library you're referring to?

I'm getting drastically different numbers for .so file sizes when comparing the apkanalyzer and classy-shark.

https://android.googlesource.com/platform/tools/base/+/studio-master-dev/apkparser

AndroidDeveloperLB commented 3 years ago

@kmadsen Sorry I forgot to put a link.

I wish I could have a reliable library&app to get information of APK files, on both Android and PC. Things such as : package-name, app-name (label), version-code, version-name, app-icon, whether it's a split APK or not...

borisf commented 3 years ago

Hi all,

Few things here

AndroidDeveloperLB commented 3 years ago

@borisf Can't use it for Android though as a library, and can't use with InputStream as a parameter, right?

Also, how exactly do you see that's possible, using this UI:

image

Where do you see that I can get the icon and name of the app?

Even when opening the manifest, I can't see it:

image

borisf commented 3 years ago

Read here how to use ClassyShark as a library

About icons yes, we don't support raw images, as there are other tools that do it

AndroidDeveloperLB commented 3 years ago

@borisf So again, there is no library that can do it for Android properly. And it's not just raw images. Those don't always exist. It's also AdaptiveIconDrawable and VectorDrawable.

About the link, this shows that it can use File. What about InputStream or Uri using ContentProvider? After all, you can't always access File on Android, especially due to the various restrictions over the years. And if I could access using File, I wouldn't have needed a library (except for the case of split APK files), because Android has this: https://developer.android.com/reference/android/content/pm/PackageManager#getPackageArchiveInfo(java.lang.String,%20int)

I wanted a library that can handle all kinds of APK files. Both normal and split APK files, and could do it even if presented Uri instead of a File.

kmadsen commented 3 years ago

.so file sizes ==> ClassyShark just prints the size of the zip entry from the APK file, @kmadsen what is your use case, please ?

@borisf exactly this, we want the zip size of each native library (.so objects) for each build. Android Studio provides the download sizes for each of these, but we want to keep record of it internally. So we're looking to turn these values into JSON objects.

https://github.com/JetBrains/android/tree/master/apkanalyzer Screen Shot 2020-08-10 at 11 59 44 AM

EDIT: Sorry I won't derail this thread, opened a new ticket over here https://github.com/google/android-classyshark/issues/189

borisf commented 3 years ago

@AndroidDeveloperLB there seems to be confusion here

ClassyShark is not intended to be used on Android phones but rather on desktop environment (swing etc), thus content providers are not in the scope ....

AndroidDeveloperLB commented 3 years ago

@borisf Well then I can ask this:

  1. What does Google offer to parse all kinds of APK files, including split APK files, including not from File API?
  2. What does this library/tool do that others don't, including even from online solutions?
  3. Why only for desktop, if it's in Java? Java is supposed to be cross platform. You are missing some, if you don't offer for Android too, especially as it's for Android apps...
  4. If it's for developers, shouldn't it also work on ChromeOS, as Android Studio also works there? Actually, speaking about Android Studio, why not have it inside Android Studio?
borisf commented 3 years ago
  1. What does Google offer to parse all kinds of APK files, including split APK files, including not from File API? If this is for running on Android devices you should look at Android Developer Documentation For development the key tools/APIs are Android Studio, ClassyShark, Play Console etc'

  2. What does this library/tool do that others don't, including even from online solutions? ClassyShark does APK/Jar/Zip parsing focusing on dex internals and method counts per classes.dex entry

  3. Why only for desktop, if it's in Java? Java is supposed to be cross platform. You are missing some, if you don't offer for Android too, especially as it's for Android apps... ClassyShark runs where Java JDK is running, Linux/OSX/Windows

  4. If it's for developers, shouldn't it also work on ChromeOS, as Android Studio also works there? Actually, speaking about Android Studio, why not have it inside Android Studio? Chrome OS I don;t know, as I didn't check

ClassyShark can't be integrated inside Android Studio as ClassyShark has different design and optimizations considerations, that require ClassyShark be a process on its own (many files, threads etc')

AndroidDeveloperLB commented 3 years ago

@borisf ClassyShark was released way after Android Studio was announced: https://github.com/google/android-classyshark/releases?after=6.4 - "First Android Drop" on Nov 3, 2015 https://en.wikipedia.org/wiki/Android_Studio

Android Studio was announced on May 16, 2013 at the Google I/O conference. It was in early access preview stage starting from version 0.1 in May 2013, then entered beta stage starting from version 0.8 which was released in June 2014.[11] The first stable build was released in December 2014, starting from version 1.0.

So your explanation doesn't hold, as developers of the tool knew there is an IDE that's for Android, and could work with it.

borisf commented 3 years ago

APK Analyzer and ClassyShark were developed concurrently to address different needs (around 2016)

AndroidDeveloperLB commented 3 years ago

@borisf Still later than Android Studio. Also, if there is one tool, doesn't mean there can't be another.