New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Skip assets #1605

Closed
cb-lixar opened this Issue Aug 30, 2017 · 10 comments

Comments

Projects
None yet
2 participants
@cb-lixar

cb-lixar commented Aug 30, 2017

tl;dr: It would be nice to be able to add e.g. -a to the decode command to skip assets altogether.

Information

  1. Apktool Version (apktool -version) - last checked 2.2.2
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - Any

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Yes
  2. If you are trying to install a modified apk, did you resign it? N/A
  3. Are you using the latest apktool version? No, but changelog doesn't indicate feature has been added.

Short and simple -- would like to be able to skip extracting assets. As far as I've seen personally these can usually be extracted with a simple unzip tool, but regardless, extracting the assets is (at least in situations where I've been using apktool) often unnecessary and in some cases flat out undesirable (for instance, I have an APK here (which I don't think I can share) that's 260MB compressed, 1.6GB uncompressed, and all we're interested in in this particular case is some of the metadata).

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Aug 30, 2017

Owner

Currently, we have 2 options that either skip sources or resources.

As you probably know, if we skip resources than we just pass the resources.arsc file onward to the decode. It then is copied back during compile.

Likewise for the sources, if enabled we just pass the classes#.dex(s) onward instead of disassembling them.

So enter assets. Right now we move them to the filesystem while remembering their compression. If we skipped assets they would be stuck in the original application and to the best of my knowledge short of making an "asset" zip in root, there is no way around keeping the compressed files outside the zip.

I'm not sure for the best course of action yet for this feature request.

Owner

iBotPeaches commented Aug 30, 2017

Currently, we have 2 options that either skip sources or resources.

As you probably know, if we skip resources than we just pass the resources.arsc file onward to the decode. It then is copied back during compile.

Likewise for the sources, if enabled we just pass the classes#.dex(s) onward instead of disassembling them.

So enter assets. Right now we move them to the filesystem while remembering their compression. If we skipped assets they would be stuck in the original application and to the best of my knowledge short of making an "asset" zip in root, there is no way around keeping the compressed files outside the zip.

I'm not sure for the best course of action yet for this feature request.

@cb-lixar

This comment has been minimized.

Show comment
Hide comment
@cb-lixar

cb-lixar Aug 31, 2017

(I responded to this earlier but either I can't reply-to-comment like Github seems to imply, something went wrong, or it went to your personal email instead or something.)

What I would expect in this case is that they are simply not extracted. Yes, this would mean that you can't rebuild the app as-is with the directory where everything else was extracted, but I'm not sure how else the feature would be interpreted. If it's a question of terminology, "don't extract" could be used instead of "skip". I doubt that in every usage of apktool the intent is to later rebuild the app.

If there were really intent to rebuild, I dunno, I'd say there'd need to be a separate feature for that that would request the original APK or something. At surface value I'd say rebuilding & skipping assets are simply mutually exclusive.

cb-lixar commented Aug 31, 2017

(I responded to this earlier but either I can't reply-to-comment like Github seems to imply, something went wrong, or it went to your personal email instead or something.)

What I would expect in this case is that they are simply not extracted. Yes, this would mean that you can't rebuild the app as-is with the directory where everything else was extracted, but I'm not sure how else the feature would be interpreted. If it's a question of terminology, "don't extract" could be used instead of "skip". I doubt that in every usage of apktool the intent is to later rebuild the app.

If there were really intent to rebuild, I dunno, I'd say there'd need to be a separate feature for that that would request the original APK or something. At surface value I'd say rebuilding & skipping assets are simply mutually exclusive.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Aug 31, 2017

Owner

We have -m / --match-original which is used for analysis. It prevents any of the "fixes" apktool does to allow rebuild. However, analysis sometimes is required for the unknown/asset files so it doesn't make sense to add this feature to that option (Just something I was thinking)

I don't have a problem adding an additional parameter for this. It may be an advanced command (thus only long version like --skip-assets or something). I don't want to pollute the shorthand command parameters anymore unless crucial and since this command won't act the same as the skip resources/sources it makes sense to separate it.

Let me get #1602 merged first as it touches the CLI/parameters and I can swing back to this.

Owner

iBotPeaches commented Aug 31, 2017

We have -m / --match-original which is used for analysis. It prevents any of the "fixes" apktool does to allow rebuild. However, analysis sometimes is required for the unknown/asset files so it doesn't make sense to add this feature to that option (Just something I was thinking)

I don't have a problem adding an additional parameter for this. It may be an advanced command (thus only long version like --skip-assets or something). I don't want to pollute the shorthand command parameters anymore unless crucial and since this command won't act the same as the skip resources/sources it makes sense to separate it.

Let me get #1602 merged first as it touches the CLI/parameters and I can swing back to this.

@iBotPeaches iBotPeaches added the Feature label Aug 31, 2017

@cb-lixar

This comment has been minimized.

Show comment
Hide comment
@cb-lixar

cb-lixar Aug 31, 2017

Well, it's possible for there to be incompatible arguments; If you want to prevent any confusion then -m / --match-original could block/warn usage of --skip-assets (or whatever the name ends up being) with some error/warning message explaining the conflict.

At any rate, that all sounds good to me and --skip-assets or --no-assets would make sense to me. I appreciate the quick responses on this, too.

cb-lixar commented Aug 31, 2017

Well, it's possible for there to be incompatible arguments; If you want to prevent any confusion then -m / --match-original could block/warn usage of --skip-assets (or whatever the name ends up being) with some error/warning message explaining the conflict.

At any rate, that all sounds good to me and --skip-assets or --no-assets would make sense to me. I appreciate the quick responses on this, too.

@cb-lixar

This comment has been minimized.

Show comment
Hide comment
@cb-lixar

cb-lixar Sep 5, 2017

So I can get an idea of if I should look for alternatives in the interim, when do you think you would be able to work on this? (I'm not trying to add any pressure.)

cb-lixar commented Sep 5, 2017

So I can get an idea of if I should look for alternatives in the interim, when do you think you would be able to work on this? (I'm not trying to add any pressure.)

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Sep 5, 2017

Owner

I have Thursday set aside this week at work to work on Apktool. I will fix up the pending PRs and see if I can add this real quick. That would seal it into the 2.3 release coming hopefully early next week.

Owner

iBotPeaches commented Sep 5, 2017

I have Thursday set aside this week at work to work on Apktool. I will fix up the pending PRs and see if I can add this real quick. That would seal it into the 2.3 release coming hopefully early next week.

@cb-lixar

This comment has been minimized.

Show comment
Hide comment
@cb-lixar

cb-lixar Sep 19, 2017

Any luck on this?

cb-lixar commented Sep 19, 2017

Any luck on this?

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Sep 19, 2017

Owner

Done. Commit above. It uses --no-assets and prevents copying of the assets folder.

Owner

iBotPeaches commented Sep 19, 2017

Done. Commit above. It uses --no-assets and prevents copying of the assets folder.

@cb-lixar

This comment has been minimized.

Show comment
Hide comment
@cb-lixar

cb-lixar Sep 19, 2017

Thanks! I noticed you have a CI but I don't see any way to download the artefact / build from it. Is it possible?

Edit: Also your Mac builder may be experiencing some sort of issue.

cb-lixar commented Sep 19, 2017

Thanks! I noticed you have a CI but I don't see any way to download the artefact / build from it. Is it possible?

Edit: Also your Mac builder may be experiencing some sort of issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Sep 19, 2017

Owner

Unfortunately not, there is no publishing attached to our CI. I am planning a release for Wed/Thur of this week.

Owner

iBotPeaches commented Sep 19, 2017

Unfortunately not, there is no publishing attached to our CI. I am planning a release for Wed/Thur of this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment