Commit Graph

86 Commits

Author SHA1 Message Date
Benjamin Adolphi
db35f54af6 Pass minimum api level to smali library
When apktool creates a DexBuilder class, it creates it without specifying a minimum api level. This causes the DexBuilder class to assume api level 20 by default. This is not ideal since in some cases, the concrete minimum api level is required.

One such case is in smali's DexWriter class which implements a workaround for a bug in Dalvik that was fixed in Android 4.2 (https://code.google.com/p/android/issues/detail?id=35304) that causes apps that call the Method.getParameterAnnotations api to crash in some cases (see bug report for more details). The workaround that smali implements is only triggered if the minimum api level is below 17 (Android 4.2). But since apktool effectively sets the minimum api level to 20, this code is never triggered causing apktool to create apk files that crash on devices below Android 4.2.

This change passes the minimum api level to the smali library.
2016-09-15 00:31:32 +02:00
Connor Tumbleson
bada6441ec
don't edit the original Manifest
- use dummy copy and restore original after build
2016-08-06 09:45:18 -04:00
Connor Tumbleson
6e509695eb
Patch newest AndroResGuard format 2016-08-06 07:56:17 -04:00
Connor Tumbleson
3a982948ea
Adds full filepath for STORED files in case of multiple extensions
- fixes #1244
 - prevents greedy extension check STORE`ing too many files
2016-07-29 09:21:52 -04:00
Connor Tumbleson
87315af36e Remove previous android:debuggable value to allow changing
- adds unit test
 - normalizeNewlines moved to TestUtils
2016-04-28 08:31:36 -04:00
Connor Tumbleson
ea2c821fa5 Add support for AndResGuard
- fixes #1170
2016-03-10 09:29:49 -05:00
Connor Tumbleson
cd852cd658 Removes SmaliDebugging
- fixes #1061
2016-02-27 20:20:53 -05:00
Connor Tumbleson
b29df52b87 Cleanup unclosed streams plus formatting
- run FindBugs to find problems
2016-02-14 20:34:06 -05:00
Rover12421
123912d226 Apktool.yml file (MetaInfo) using object serialization
non-printable character more intuitive, does not affect printable
character view
2016-01-22 06:28:03 -06:00
Connor Tumbleson
0011498b52 [skip] rename var to match extension or file without extension 2016-01-06 12:49:55 -06:00
Andrei Zhukouski
22bd5b0acc Fixes issue #1122 2016-01-04 13:15:54 +03:00
Ira Hanson
8232ee0ea8 Consistently encode unknown filenames to prevent cast error 2016-01-02 21:40:15 -06:00
Connor Tumbleson
5e4bae0526 Only stores extension(s) of uncompressed files
- fixes #1053
2015-10-13 07:28:43 -05:00
Andrew Grieve
392420c909 Adds doNotCompress list to apktool.yml
This is the list of files (resources, assets, etc) that are stored in
the .apk uncompressed.

For apps that use AssetFileDescriptor.openFd(), the adding compression
will break the call.

Maintains support for the resourcesAreCompressed key, but no longer
records it when decompiling (it instead records resources.arsc in the
doNotCompress list).
2015-08-14 11:52:33 -04:00
Connor Tumbleson
e407fe839b Correctly rebuild /libs & /lib folder on [b]uild 2015-04-22 07:21:02 -05:00
Connor Tumbleson
3208624bf6 Moves all XML parsing related functions to new class: ResXmlPatcher 2015-04-16 08:24:30 -05:00
Connor Tumbleson
addbf8336d [WIP] Wires up rewriter of @string references in provider attrs
- finds all <providers> in manifest
 - finds corresponding @string in res/values/strings.xml
 - does reference replacement w/ literal value
 - fixes #636
2015-04-16 08:24:30 -05:00
Connor Tumbleson
7326867b09 re-add copy() method using try-with-resources 2015-04-16 08:12:20 -05:00
Connor Tumbleson
10afb3cd56 Merge branch 'del_BrutIO_copy' of https://github.com/rover12421/Apktool into rover12421-del_BrutIO_copy 2015-04-16 08:03:44 -05:00
Connor Tumbleson
a561a95542 Don't ignore multiple dex files when -s is used
- fixes #904
2015-04-04 08:09:07 -05:00
Rover12421
407ffdc5fe remove BrutIO copy method
`copy` method already in IOUtils
2015-03-30 13:30:52 +08:00
Greg Leach
39a2848340 Moving a couple utility functions into BrutIO. Also, formatting change to match spec. 2015-03-25 09:56:55 -07:00
Greg Leach
472a02db41 Formatting for right-hand margin 2015-03-24 20:22:05 -07:00
Greg Leach
628286c022 Java NIO doesn't allow the preservation of the compression method (STORED vs DEFLATED), so unfortunately we need to fall back to ZipEntry-based output for unknown files. 2015-03-24 20:14:05 -07:00
Rover12421
f3582b60db buildUnknownFiles optimization
newFileSystem will file replication overhead
2015-03-18 09:15:26 +08:00
Connor Tumbleson
fac43a62b8 remove dependency on sharedLibrary in apktool.yml 2015-03-14 08:20:00 -05:00
Connor Tumbleson
0a74de4ab0 Shared Library Rebuilding Support
- handles references with shared resources
 - adds support for --shared-lib
 - update unit-tests
2015-03-14 08:04:33 -05:00
Connor Tumbleson
81e6af093b Removes general access bit hack
- fixed in aosp: android_libcore/commit/25681be69e19a834b00cfbf54cd99ac13f12b9ff
 - reverts 42f69fd745
 - reverts 47a5eac0b0
 - fixes googlecode issue 744
2015-01-21 07:12:26 -06:00
Connor Tumbleson
e281f81546 [skip] during info message, don't show apk build dir 2015-01-19 07:25:21 -06:00
Connor Tumbleson
4882396163 Prevent casting strings that resemble filepaths to ResFileValues
- add testcase
 - adapt changes
 - introduce decodeManifestWithResources which uses attr decoding w/ resources
2014-12-26 08:08:50 -06:00
Connor Tumbleson
40fdfc50a1 Options Cleanup
- remove ugly Hashmap passing
 - create ApkOptions
 - refactor based on ApkOptions
2014-11-01 21:07:02 -05:00
Connor Tumbleson
d821717253 java7 try-with-resources and multi catch 2014-10-29 16:18:25 -05:00
Connor Tumbleson
9031c22365 [skip] update all copyrights to 2014 2014-10-23 18:14:48 -05:00
Connor Tumbleson
7b0ba28a43 [skip] code style 2014-09-23 08:24:45 -05:00
Connor Tumbleson
56c953cd16 don't break BC, store classes.dex in /smali 2014-08-16 09:54:34 -05:00
Connor Tumbleson
b2b5eb5f01 [skip] cs fixes, added changes to changelog 2014-08-16 09:48:02 -05:00
Connor Tumbleson
7ef993cc75 Multiple Dex Support - part 3
- dexlib2 handles non classes.dex
 - cleaned up functions
 - cs fixes
2014-08-16 08:45:43 -05:00
Connor Tumbleson
c476ce16be Multiple Dex Support - part 2
- CS fixes
 - adds support for building multiple dex
 - prevents extra dex from being unknown and extra dex
 - adds unit-test
2014-08-16 08:29:57 -05:00
Connor Tumbleson
70eaab9971 Multiple Dex Support
- CS fixes
 - added decode support for multiple dexes
 - decoded to smali_[dex name]
2014-08-15 20:24:12 -05:00
Connor Tumbleson
a031787ece switch from URI to Paths 2014-05-03 07:37:52 -05:00
Connor Tumbleson
b5dcce3738 abstracted unknown files out of resources, to remove dependencies on ResTable 2014-03-02 08:46:35 -06:00
Connor Tumbleson
65b188ae96 fixes unknown files being ignored if prefixed with known file 2014-02-16 11:20:06 -06:00
Connor Tumbleson
f85dc478b2 Github pr #81 - correctly handle non-URI characters in filename 2014-02-10 07:17:56 -06:00
Connor Tumbleson
086139a037 code cleanup of 2014 2014-02-09 19:01:57 -06:00
Connor Tumbleson
dc2b2fecb8 cleanup new lines and fixup revision properties 2014-02-04 09:52:09 -06:00
Connor Tumbleson
e254cec648 rework manifest renaming
Issue #526, correctly handles apks where a renamed package is required, by comparing the package name present
in AndroidManifest.xml and resources.arsc. If different, we take the package name present
in resources.arsc (original) and replace it in the <manifest> tag of AndroidManifest.xml. The previous value in
AndroidManifest.xml (renamed) becomes the value to be passed to aapt on rebuild via --rename-manifest-package

Both these values along with the package id of the original are stored in apktool.yml, for use during the
rebuild
2014-01-07 10:59:37 -06:00
Connor Tumbleson
259ff5ef01 fix nio2 windows problem - funorpain 2013-12-08 16:48:59 -06:00
Connor Tumbleson
02ac674551 Add apktool version to output during decode/rebuild 2013-09-17 21:52:09 -05:00
Connor Tumbleson
054ddb1388 Fix for window builds due to java.nio 2013-09-07 08:53:07 -05:00
Connor Tumbleson
fb7fbf0805 pass api to DexFileFactory 2013-08-12 09:16:51 -05:00