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

Copy all unknown files to resulting apk. #174

Closed
iBotPeaches opened this Issue Mar 18, 2015 · 18 comments

Comments

Projects
None yet
1 participant
@iBotPeaches
Owner

iBotPeaches commented Mar 18, 2015

Original issue 63 created by liudas.survila on 2010-06-23T06:53:16.000Z:

What steps will reproduce the problem?

  1. dowload "Are you smarter than a 5th Grader.apk"
  2. apktool decode "Are you smarter than a 5th Grader.apk" out

What is the expected output? What do you see instead?
In out folder there should be that /data folder, which is in the original pack. And of course, when you try to run built package, you get NullPointerException, because those required files are not found.

What version of the product are you using? On what operating system?
Tried with 1.3.1 and 1.2.0 versions. Windows XP.

Please provide any additional information below.
If I manually put those files into the out folder,
apktool build out test.apk
just ignores them and won't put them into built package.

If I manually put those files into the built package, install it, I get this errors in LogCat:
...
06-23 06:08:01.410: ERROR/AndroidRuntime(308): Uncaught handler: thread main exiting due to uncaught exception
06-23 06:08:01.430: ERROR/AndroidRuntime(308): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.capcomcanada.fifthGrader2009/com.capcomcanada.fifthGrader2009.FifthGrader2009}: java.lang.NullPointerException
...

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #1 originally posted by Brut.alll on 2010-08-27T21:01:49.000Z:

Issue 68 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #1 originally posted by Brut.alll on 2010-08-27T21:01:49.000Z:

Issue 68 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #2 originally posted by Brut.alll on 2010-08-27T21:07:29.000Z:

I have tried to create similar app to "Are you (...).apk" and "Collapse_v1.0.apk", but Android SDK ignores unknown files as well. My guess is authors of these apps have altered apks after build, because I don't think you could build such an app in normal way :-/

I have to add a feature to apktool, so it will copy all unknown files to resulting apk.

Owner

iBotPeaches commented Mar 18, 2015

Comment #2 originally posted by Brut.alll on 2010-08-27T21:07:29.000Z:

I have tried to create similar app to "Are you (...).apk" and "Collapse_v1.0.apk", but Android SDK ignores unknown files as well. My guess is authors of these apps have altered apks after build, because I don't think you could build such an app in normal way :-/

I have to add a feature to apktool, so it will copy all unknown files to resulting apk.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #3 originally posted by Brut.alll on 2010-08-27T21:08:36.000Z:

<empty>

Owner

iBotPeaches commented Mar 18, 2015

Comment #3 originally posted by Brut.alll on 2010-08-27T21:08:36.000Z:

<empty>

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #4 originally posted by weiss.yoav on 2011-04-04T11:45:53.000Z:

It is actually quite common with proprietary build systems. They include certain files in the apk and access them directly from the code. Usually it's config files or other resources used by some library they're using.

A good example is apps published by Citrix. For example https://market.android.com/details?id=com.citrix.labs.Receiver in which they include a whole tree of files with the ".properties" extension. Rebuild the apk without them and the app will break in subtle ways not immediately visible. See the attached apk.

The fix is simple. I extract the files from the origin apk, rebuild with apktool and manually add all the missing files. I think this should be the default behavior for apktool when encountering an unknown file. Same way it handles shared objects in the lib directory.

Owner

iBotPeaches commented Mar 18, 2015

Comment #4 originally posted by weiss.yoav on 2011-04-04T11:45:53.000Z:

It is actually quite common with proprietary build systems. They include certain files in the apk and access them directly from the code. Usually it's config files or other resources used by some library they're using.

A good example is apps published by Citrix. For example https://market.android.com/details?id=com.citrix.labs.Receiver in which they include a whole tree of files with the ".properties" extension. Rebuild the apk without them and the app will break in subtle ways not immediately visible. See the attached apk.

The fix is simple. I extract the files from the origin apk, rebuild with apktool and manually add all the missing files. I think this should be the default behavior for apktool when encountering an unknown file. Same way it handles shared objects in the lib directory.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #5 originally posted by Brut.alll on 2011-05-03T08:43:35.000Z:

Issue 107 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #5 originally posted by Brut.alll on 2011-05-03T08:43:35.000Z:

Issue 107 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #6 originally posted by rogerbinns on 2012-02-03T05:53:03.000Z:

Note that things are trickier than just copying the files across. In many cases you also need to pay attention to the compression used. If the file is compressed in the zip then random access is eye wateringly slow. Some apks have files deliberately stored and not compressed because they do random access to them.

I actually go to the trouble afterwards of copying missing files over, and also ensuring that the compress/store decision is exactly the same, repacking the apk if needed.

Owner

iBotPeaches commented Mar 18, 2015

Comment #6 originally posted by rogerbinns on 2012-02-03T05:53:03.000Z:

Note that things are trickier than just copying the files across. In many cases you also need to pay attention to the compression used. If the file is compressed in the zip then random access is eye wateringly slow. Some apks have files deliberately stored and not compressed because they do random access to them.

I actually go to the trouble afterwards of copying missing files over, and also ensuring that the compress/store decision is exactly the same, repacking the apk if needed.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #7 originally posted by connor.tumbleson on 2012-11-16T13:02:16.000Z:

Issue 331 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #7 originally posted by connor.tumbleson on 2012-11-16T13:02:16.000Z:

Issue 331 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #8 originally posted by connor.tumbleson on 2013-01-19T16:44:17.000Z:

Issue 397 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #8 originally posted by connor.tumbleson on 2013-01-19T16:44:17.000Z:

Issue 397 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #9 originally posted by connor.tumbleson on 2013-01-20T06:37:06.000Z:

I've been thinking of a way to do this, but it probably needs to be held off until v2.0

I don't want to dump any more information into apktool.yml, but I feel this feature might require a huge dump of information.

For example,

Apktool reads any unknown folder and recursively any file/folder inside of it. Recording the name and storage (compress/store) of it.

Then on rebuild (if extras_apktool.yml) or something exists. Then it can read that file to know what to include into the APK/JAR along w/ proper storage types.

Owner

iBotPeaches commented Mar 18, 2015

Comment #9 originally posted by connor.tumbleson on 2013-01-20T06:37:06.000Z:

I've been thinking of a way to do this, but it probably needs to be held off until v2.0

I don't want to dump any more information into apktool.yml, but I feel this feature might require a huge dump of information.

For example,

Apktool reads any unknown folder and recursively any file/folder inside of it. Recording the name and storage (compress/store) of it.

Then on rebuild (if extras_apktool.yml) or something exists. Then it can read that file to know what to include into the APK/JAR along w/ proper storage types.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #10 originally posted by connor.tumbleson on 2013-03-11T14:02:45.000Z:

<empty>

Owner

iBotPeaches commented Mar 18, 2015

Comment #10 originally posted by connor.tumbleson on 2013-03-11T14:02:45.000Z:

<empty>

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #11 originally posted by connor.tumbleson on 2013-03-21T10:37:59.000Z:

Issue 434 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #11 originally posted by connor.tumbleson on 2013-03-21T10:37:59.000Z:

Issue 434 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #12 originally posted by connor.tumbleson on 2013-03-30T22:17:05.000Z:

<empty>

Owner

iBotPeaches commented Mar 18, 2015

Comment #12 originally posted by connor.tumbleson on 2013-03-30T22:17:05.000Z:

<empty>

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #13 originally posted by connor.tumbleson on 2013-04-06T18:33:40.000Z:

Issue 418 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #13 originally posted by connor.tumbleson on 2013-04-06T18:33:40.000Z:

Issue 418 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #14 originally posted by connor.tumbleson on 2013-05-04T00:26:44.000Z:

Fixed for Apktool 2.0

Owner

iBotPeaches commented Mar 18, 2015

Comment #14 originally posted by connor.tumbleson on 2013-05-04T00:26:44.000Z:

Fixed for Apktool 2.0

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #15 originally posted by connor.tumbleson on 2013-06-22T14:11:48.000Z:

Issue 475 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #15 originally posted by connor.tumbleson on 2013-06-22T14:11:48.000Z:

Issue 475 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #16 originally posted by connor.tumbleson on 2013-10-24T11:47:46.000Z:

Issue 537 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #16 originally posted by connor.tumbleson on 2013-10-24T11:47:46.000Z:

Issue 537 has been merged into this issue.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #17 originally posted by m@rcel.cz on 2013-11-10T16:12:28.000Z:

I'm using apktool_2.0.0b7.jar but it still doesn't include all unknown files in the dist apk. There's a lot of apps with such files (TripAdvisor, Booking etc). Attached logs from building TripAdvisor apk (first with spaces in filename, second try without space).

Owner

iBotPeaches commented Mar 18, 2015

Comment #17 originally posted by m@rcel.cz on 2013-11-10T16:12:28.000Z:

I'm using apktool_2.0.0b7.jar but it still doesn't include all unknown files in the dist apk. There's a lot of apps with such files (TripAdvisor, Booking etc). Attached logs from building TripAdvisor apk (first with spaces in filename, second try without space).

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #18 originally posted by connor.tumbleson on 2014-05-21T11:43:13.000Z:

Issue 634 has been merged into this issue.

Owner

iBotPeaches commented Mar 18, 2015

Comment #18 originally posted by connor.tumbleson on 2014-05-21T11:43:13.000Z:

Issue 634 has been merged into this issue.

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