Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

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

Open
AndroidDeveloperLB opened this issue Nov 30, 2019 · 13 comments
Open

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

AndroidDeveloperLB opened this issue Nov 30, 2019 · 13 comments

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Nov 30, 2019

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
Copy link

kmadsen commented Aug 17, 2020

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
Copy link
Author

@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
Copy link
Contributor

borisf commented Aug 17, 2020

Hi all,

Few things here

  • package-name, app-name (label), version-code, version-name, app-icon ==> ClassyShark supports from the manifest (ClassyShark doesn't support splits)
  • .so file sizes ==> ClassyShark just prints the size of the zip entry from the APK file, @kmadsen what is your use case, please ?

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Aug 17, 2020

@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
Copy link
Contributor

borisf commented Aug 17, 2020

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
Copy link
Author

@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
Copy link

kmadsen commented Aug 20, 2020

.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 #189

@borisf
Copy link
Contributor

borisf commented Aug 20, 2020

@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
Copy link
Author

@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
Copy link
Contributor

borisf commented Aug 21, 2020

  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
Copy link
Author

@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
Copy link
Contributor

borisf commented Aug 21, 2020

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

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Aug 21, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants