Commit Graph

1010 Commits

Author SHA1 Message Date
wangyilei
e0e6cfd03f only log string decode warning when failed 2021-03-06 22:00:54 +08:00
wangyilei
5a66b2c42d support lib/specType chunk out-of-order reading 2021-03-06 21:58:23 +08:00
Connor Tumbleson
e9a897febe
build: syntax updates for gradle files 2021-03-04 07:21:22 -05:00
Connor Tumbleson
98aa7acb22 fix: skip files that violate safe filepath 2020-12-11 07:10:05 -05:00
Connor Tumbleson
b17832f0e1
style: add missing license headers 2020-12-11 07:07:54 -05:00
Connor Tumbleson
785cb4f89d
test: add High Brightness Symbol into tests for feature test against #2299 2020-12-11 07:06:14 -05:00
Comnir
961f1f94f6 Rename variables in tests. 2020-12-10 14:44:01 +02:00
Comnir
f1321c8437 fix issue 2299: Unicode code points higher than 0x10000 decoding fails.
- Use CESU8 decoder instead of UTF-8 in StringBlock.
- DEX uses Modified UTF-8 which is close to CESU-8 (https://source.android.com/devices/tech/dalvik/dex-format#mutf-8)
2020-12-10 12:38:55 +02:00
Comnir
201b5976bb Add tests for StringBlock#decodeString with failing tests for code points above 0x10FFFF (issue 2299). 2020-12-10 12:29:34 +02:00
Connor Tumbleson
6d4e503b16 fix: rename duplicate attributes to not start with numeric 2020-12-04 06:14:27 -05:00
Connor Tumbleson
d1c006b260
build: add latest linux/windows/mac aapt|aapt2 binaries (#2450)
* build: add latest linux/windows aapt|aapt2 binaries

* build: add latest mac aapt|aapt2 binaries
2020-12-03 06:18:01 -05:00
Connor Tumbleson
d63088db9f feat: method to list frameworks 2020-11-30 07:11:08 -05:00
Connor Tumbleson
db1fe98524 feat: usage output for list-frameworks 2020-11-30 07:11:08 -05:00
Connor Tumbleson
734793c4bb fix: survive if referent is null (flags) 2020-11-29 09:34:43 -05:00
Connor Tumbleson
5f7630e325 fix: survive if referent is null (enum) 2020-11-29 09:34:43 -05:00
Connor Tumbleson
2d41305998
fix: v2.6.0 not v1.6.0 2020-11-28 21:15:30 -05:00
Connor Tumbleson
3ab1a1a5e4 fix: fallback to res-auto namespace if non-android pkg 2020-11-28 16:58:31 -05:00
Connor Tumbleson
150ffc4fdc style: remove weird indented code 2020-11-28 16:58:31 -05:00
Connor Tumbleson
f1393c3ca6 refactor: return null, if always null 2020-11-28 16:58:31 -05:00
Connor Tumbleson
2eac0339b4 refactor: use easier to read string decode 2020-11-28 16:58:31 -05:00
Connor Tumbleson
db70927699 style: remove unused imports 2020-11-28 16:58:31 -05:00
Connor Tumbleson
45ae71204e chore: remove StringBlock unused m_stringOwns 2020-11-28 16:58:31 -05:00
Connor Tumbleson
4f13bcad48 fix: add message explaining deprecation of 32bit 2020-11-28 16:26:00 -05:00
Connor Tumbleson
7cf9a95710 fix: add better error message when can't write framework file 2020-11-28 16:19:29 -05:00
Connor Tumbleson
a91aad461e
fix: secure links in usage output 2020-11-28 16:18:54 -05:00
Connor Tumbleson
693d8d1fbf
style: copyright year to start of project 2020-11-28 16:18:40 -05:00
Connor Tumbleson
590f9c1392
fix: remove warning about smali-debugging 2020-11-28 09:10:37 -05:00
Connor Tumbleson
94e224ee3f
fix: delay -c removal till 2.6 2020-11-28 08:59:48 -05:00
Connor Tumbleson
5a54b472d1 fix: set dummy attributes to same type (@null) 2020-11-28 08:59:18 -05:00
Connor Tumbleson
43010de4e8 style: remove unused import 2020-11-28 06:59:48 -05:00
Connor Tumbleson
b896b4491a fix: prevent NPE during decode app with no matching resId for resource 2020-11-28 06:59:48 -05:00
Connor Tumbleson
cd7405d31b build: update add latest mac aapt|aapt2 binaries 2020-11-27 15:55:36 -05:00
Connor Tumbleson
3043266ee5 build: update add latest linux/windows aapt|aapt2 binaries 2020-11-27 15:55:36 -05:00
Connor Tumbleson
6bd1ab603b test: add triple dex test to aapt1 2020-11-27 10:51:54 -05:00
Connor Tumbleson
5658c959b4 test: add triple dex test on aapt2 2020-11-27 10:51:54 -05:00
Connor Tumbleson
9170c5a04b build: fix chmod on mac binaries 2020-11-27 09:22:41 -05:00
Connor Tumbleson
1dfac6d8bf build: add latest linux/windows aapt|aapt2 binaries 2020-11-27 09:22:41 -05:00
Connor Tumbleson
d7e27ffc69 build: add latest mac aapt|aapt2 binaries (API 30) 2020-11-27 09:22:41 -05:00
Connor Tumbleson
231ce72483 test: add more tests for #2386 2020-11-27 09:22:41 -05:00
Connor Tumbleson
c501952c69 build: add latest linux/windows aapt|aapt2 binaries (API 30) 2020-11-27 09:22:41 -05:00
Connor Tumbleson
d6f84df00b fix: leading 0s not supported in aapt anymore 2020-11-27 09:22:41 -05:00
Connor Tumbleson
efeb09e037 build: add latest linux/windows aapt|aapt2 binaries 2020-11-27 09:22:41 -05:00
Connor Tumbleson
3101a05ef6
fix: add development next version (S) - API 31 2020-09-13 08:52:15 -04:00
Connor Tumbleson
6427a28beb
refactor: prevent casting by setting proper types 2020-09-13 08:45:30 -04:00
Connor Tumbleson
943b424172
fix: use proper array syntax 2020-09-13 08:45:05 -04:00
Connor Tumbleson
120c63df75
refactor: remove unused methods/variables 2020-09-13 08:44:40 -04:00
Connor Tumbleson
65eeb2fb4a
refactor: make constant values final 2020-09-13 08:44:08 -04:00
Connor Tumbleson
2720cf93a3
refactor: put same path switch on same line 2020-09-13 08:41:55 -04:00
Connor Tumbleson
35a4bd6718
style: re-org exceptions to have suffix (#2400)
* style: re-org exceptions to have suffix

* fix: add missing exception for ResResSpec
2020-09-13 08:40:03 -04:00
Connor Tumbleson
22fdee4d2e
feat: update internal framework to API 30 (11 Release) 2020-09-12 11:54:15 -04:00
Giacomo Ferretti
d3f9d5acd2 build: update 'proguard' from 6.1.1 to 7.0.0
`jcenter()` it's needed because they didn't upload to Maven Central yet. https://github.com/Guardsquare/proguard/issues/54

There are some minor issues with proguard still.
It produces a lot of warnings since Gradle 6.0, but it's fixable on their side. https://github.com/Guardsquare/proguard/issues/14
2020-08-14 07:56:52 -04:00
Giacomo Ferretti
4c3f1f335a refactor: 'compile' it's deprecated
`compile` it's deprecated since Gradle 6.0 and been discouraged since Gradle 3.4.

We should use `implementation` and `api` instead because `compile` will be removed in Gradle 7.0.

https://docs.gradle.org/6.5.1/userguide/upgrading_version_5.html#deprecations
2020-08-14 07:56:52 -04:00
Ankit Pati
87a9c659f5 convert CRLF line endings to LF in .java file 2020-08-09 07:57:00 -04:00
Ankit Pati
8009a10a5d remove executable bit set on .java file 2020-08-09 07:54:51 -04:00
Connor Tumbleson
de5d0e41cf fix: prevent nullying out sdk info when compileSdkVersion is found 2020-06-27 15:21:05 -04:00
Leo Wandersleb
546577df6a exit code 1 if parameters are wrong
for use in scripts, it's not convenient to get an exit code 0 on
failure.
2020-06-16 06:18:57 -04:00
Comnir
ecbcfb437e match test apk name with the relevant issue. 2020-06-09 07:08:22 -04:00
Comnir
306959a6fb fix the usage of debug flag (-d) when using aapt2
- when using aapt and debug flag, we remove the 'debuggable' attribute from AndroidManifest and aapt adds it back. (see issue 1621)
- when using aapt2 and debug flag, we add and set the value of 'debuggable' attribute ourselves.
2020-06-09 07:08:22 -04:00
Peter Retzlaff
408050ffde Add tests to ensure empty, uncompressed files are put on the doNotCompress list.
Also, fix a bug where ext would retain its value from a previous
iteration of the loop, since we don't always overwrite it now.
2020-06-09 07:05:43 -04:00
Peter Retzlaff
05f81f9dd0 Change zero-byte-file tests so they test the correct behavior.
* The empty test file needs to be STORED in the testapp, so put it on
  the initial doNotCompress list.
* It needs to have a file extension that matches the NO_COMPRESS_PATTERN.
* assertNotSame tests for object equality, which doesn't work for String
  comparisons.
2020-06-09 07:05:43 -04:00
Peter Retzlaff
5db19b3329 Put empty, uncompressed files on doNotCompress list (fixes #2333).
We do not want one empty file to cause all files with that extension to
not be compressed, so we always put the full filename on the doNotCompress
list in this case.
2020-06-09 07:05:43 -04:00
Connor Tumbleson
83a45921ea fix: put the resources.arsc file under STORED compression into framework 2020-04-12 07:27:28 -04:00
Connor Tumbleson
3f831c8221
refactor: copyright year should be year started, not current year 2020-04-11 06:33:05 -04:00
Frieder Bluemle
81ca785e02
Fix file header comment format 2020-02-29 17:37:46 -08:00
Connor Tumbleson
ee54853718
feat: update internal framework to API 29 (10 Release) 2019-11-29 11:43:31 -05:00
Connor Tumbleson
b05f19b80d fix: patch aapt2 to not run custom commands on passed aapt2 binary 2019-11-20 06:46:06 -05:00
Peter Retzlaff
d6f38e38cd Only attempt to use -e option when the packaged aapt binary is used. 2019-11-20 06:46:06 -05:00
Peter Retzlaff
5d488e5f22 Create file containing the do-not-compress extensions and pass it to aapt. 2019-11-20 06:46:06 -05:00
Connor Tumbleson
b02b265ae2
style: cleanup syntax 2019-11-19 06:55:27 -05:00
Connor Tumbleson
7910802648
Merge branch 'fix/uncompressed_files_bug' of https://github.com/realityJie/Apktool into realityJie-fix/uncompressed_files_bug 2019-11-19 06:53:00 -05:00
Connor Tumbleson
37505ff509 build: update aapt/aapt2 binaries to 71b16b59 (mac) 2019-11-18 19:48:33 -05:00
Connor Tumbleson
9e75e593a6 build: update aapt/aapt2 binaries to 71b16b59 (windows) 2019-11-18 19:48:33 -05:00
Connor Tumbleson
557b763c1c build: update aapt/aapt2 binaries to 71b16b59 (unix) 2019-11-18 19:48:33 -05:00
huangweijie
17ad91da61 fix bug of Unrecognized option: --only-main-classes 2019-11-15 08:47:22 -05:00
Brian Pak
31a23ba493 Fix AXML parser to handle obfuscated attribute names
This adds an additional check if the attribute namespace belongs to
Android namespace, and if so we try to decode using attribute decoder.

Fixes #1576.
2019-11-14 18:37:25 -05:00
huangweijie
5197e21d75 there files should not be compressed:
1.base on AOSP's frameworks/base/tools/aapt/Package.cpp: NO_COMPRESS_PATTERN = Pattern.compile("(jpg|jpeg|png|gif|wav|mp2|mp3|ogg|aac|mpg|mpeg|mid|midi|smf|jet|rtttl|imy|xmf|mp4|" +
            "m4a|m4v|3gp|3gpp|3g2|3gpp2|amr|awb|wma|wmv|webm|mkv)$"); specifically this rule include 9patch files.
2.file has not ext
3.the compressive type is store

warning:
even if there are the same type of files, they are compressive type may different, just like this example:
-rw----     1.0 fat     8343 b-  0% stor 80-Jan-01 08:00 assets/resources/assets/effect/common/ctp_trail15_1_tex.unity3d
-rw----     1.0 fat    11526 b-  0% stor 80-Jan-01 08:00 assets/resources/assets/effect/common/ctp_trail15_tex.unity3d
-rw----     2.0 fat     2483 bl 19% defN 80-Jan-01 08:00 assets/resources/assets/effect/common/cw_310300_cylq_ql01_mat.unity3d
-rw----     2.0 fat     9467 bl 17% defN 80-Jan-01 08:00 assets/resources/assets/effect/common/cw_310300_cylq_ql03_fbx.unity3d
ctp_trail15_1_tex.unity3d and ctp_trail15_tex.unity3d are uncompressed, but cw_310300_cylq_ql01_mat.unity3d and cw_310300_cylq_ql03_fbx.unity3d are compressed.

That is why I modified recordUncompressedFiles Method.
2019-11-14 12:02:49 +08:00
IgorEisberg
a33141646b Fix JDK 11 build 2019-10-20 21:23:30 +03:00
IgorEisberg
232e801e4d build: update to smali/baksmali 2.3.4 2019-10-18 04:03:53 +03:00
Connor Tumbleson
197d468727
Merge pull request #2175 from danielmalmq/master
Fixes issue with decoding apk containing a zero byte 9patch
2019-10-06 05:24:04 -04:00
yangjing.yeoh
9e39755750 bugfix, fix get wrong package ResPackage for multi-pkg resources.arsc. 2019-09-23 18:39:18 +08:00
Daniel Malmqvist
dc312a5336 Fixes issue with decoding apk containing a zero byte 9patch 2019-09-19 13:34:06 +02:00
Connor Tumbleson
fefc5e226a
refactor: use MultiDexContainer instead of DexBackedDexFile 2019-08-17 07:00:15 -04:00
Connor Tumbleson
c2065995ed
feat: update internal framework to API 29 (Q Beta 4)
- fixes: #2131
2019-07-20 12:32:14 -04:00
Connor Tumbleson
4aa933b31a
test: ensure we don't allow path traversal with win 2019-07-18 07:42:34 -04:00
Connor Tumbleson
9fcd7e4d36
style: grammar for "decompile" vs "disassemble" 2019-07-14 07:35:09 -04:00
Connor Tumbleson
342661cbaa
fix: correct license header on "DuplicateDexTest" 2019-07-14 07:30:41 -04:00
Connor Tumbleson
bae5aab78a
fix: use only long builder for "--only-main-classes" 2019-07-14 07:29:47 -04:00
Connor Tumbleson
9edcc78ee5
style: clean test file 2019-07-14 07:29:32 -04:00
Connor Tumbleson
4d1e6ccbe4
refactor: remove pollution of global command and move to advanced
- removes "-onlymainclasses" for long "--only-main-classes"
2019-07-14 07:23:18 -04:00
Daniel Malmqvist
d79724549c
Added new option to skip non classes[0-9]*.dex files 2019-07-14 07:17:20 -04:00
Connor Tumbleson
5a51c5f96d
style: add comment for explanation of 9patch minimization 2019-07-14 07:09:39 -04:00
Igor Eisberg
bc9f465f3e
Fix the massive list of uncompressed 9.png that prevents recompile on Windows
Windows has its limits, even Windows 10, at least on older versions before the max path length restriction was removed.
Because apktool failed to recognize the .9.png extension as a variety of the .png extension, those .9.png files were piling up in apktool.yml and then passed to aapt, which would fail to run on Windows because of an immense command length.
This fix makes a special exception for the .png exception and will allow the .9.png one to pass as another .png extension.

Before: http://dpaste.com/2BC3RRB
After: http://dpaste.com/177CVZQ
2019-07-14 07:04:49 -04:00
Connor Tumbleson
103aa978df
refactor: remove outdated ALLOWED_PACKAGES constant 2019-07-14 06:56:37 -04:00
Igor Eisberg
8084762274
Fix recompile of miui.apk by allowing package renaming
This old issue prevented the package to be renamed from com.miui.core to miui, making it impossible to recompile, as all attributes are refefred to as miui:*/*. This fixes it permanently.
2019-07-14 06:54:32 -04:00
Connor Tumbleson
3990598373
fix: restore licenses wiped by 2017 license change 2019-07-13 12:23:22 -04:00
Connor Tumbleson
25a1cb02ef
fix: License 2019 update 2019-07-13 12:19:41 -04:00
Connor Tumbleson
81acde7613
fix: add deprecation notice into code for #2129 2019-07-13 12:08:59 -04:00
Connor Tumbleson
0aad85a0a0
fix: add more missing modules
- thanks http://cr.openjdk.java.net/~mr/jigsaw/ea/module-summary.html
2019-07-13 08:54:19 -04:00
Connor Tumbleson
4888a5a9f0
build: add desktop/sql jmod files 2019-07-13 08:47:16 -04:00
Connor Tumbleson
24c3c0dbc9
fix: properly determine greater than java8 2019-07-13 08:37:59 -04:00
Connor Tumbleson
6aeb7d39d7
fix: remove deprecated shadowJar features 2019-07-13 08:22:30 -04:00
Connor Tumbleson
e3bead4b5b
build: support for jdk9+ build 2019-07-13 07:54:41 -04:00
Shaheen Gandhi
2bc8feb549 Add attr resource type handling 2019-07-02 19:23:33 -04:00
Connor Tumbleson
1b4f8ec68c
fix: move outjars to end of proguard file 2019-06-01 10:57:19 -04:00
Connor Tumbleson
5f43a1fbca
style: cleanup formatting 2019-06-01 09:27:41 -04:00
Adib Faramarzi
61088302e3 Add unit tests
- add APK file containing a simple app that tries to use coroutines every 2 seconds, and would fail with earlier versions of APKTool
- add unit test for decoding the app
- add unit test for building a decoded app
2019-05-30 22:18:04 +04:30
Adib Faramarzi
cfd50acd1d Add unit tests
- add APK file containing a simple app that tries to use coroutines every 2 seconds, and would fail with earlier versions of APKTool
- add unit test for decoding the app
2019-05-30 22:12:57 +04:30
Adib Faramarzi
fa99bdd19d Fix removal of META-INF/services folder
- copy the META-INF/services folder to the destination APK folder so it does not get dropped
2019-05-30 19:08:21 +04:30
Adib Faramarzi
154da4c643 Fix removal of META-INF/services folder
- copy the META-INF/services folder to the destination APK folder so it does not get dropped
2019-05-30 18:46:59 +04:30
Connor Tumbleson
25a65186a9 test: add "android:appCategory=game" into AndroidManifest.xml
- refs: #2055
2019-05-07 18:12:53 -04:00
Connor Tumbleson
6c17e1a14f fix: prevent NPE when key-element is null 2019-04-26 15:17:03 -04:00
Connor Tumbleson
f1357109aa style: reorganize MXSerializer 2019-04-26 14:26:20 -04:00
Connor Tumbleson
3037024022 test: add 32,767 byte string for aapt2
- https://issuetracker.google.com/issues/73456167
2019-04-26 14:11:41 -04:00
Connor Tumbleson
4030e94cb3 test: aapt2 test for raw qmg file 2019-04-26 11:14:51 -04:00
Connor Tumbleson
adbde1745f fix: "qpm" can exist without 9patch, and use new "copyToDir" 2019-04-26 11:14:31 -04:00
Connor Tumbleson
73ac0d96fb
Merge pull request #2066 from iBotPeaches/issue-2045
Support for SDK_Q shorthand
2019-04-24 19:56:15 -04:00
Connor Tumbleson
95fe0f3f02 test: assert SDK_Q works with insane test value (10,000) 2019-04-24 18:46:48 -04:00
Connor Tumbleson
f3f634f010 fix: add SDK_Q (test) value of 10,000 2019-04-24 18:46:48 -04:00
Connor Tumbleson
2e75f7b799 fix: create directory if doesn't exist, before error 2019-04-24 18:45:57 -04:00
Connor Tumbleson
cc194daf83
fix: document 2.4.0 change on "api-level" for build
- fixes: #2027
2019-03-03 07:03:12 -05:00
Connor Tumbleson
8e00de38a0
Merge branch 'master' into patch-1 2019-02-27 18:26:02 -05:00
Igor Eisberg
400a463286
Fix APKs with SDK versions being reference values
This non-standard behavior is rare, but quite annoying.
The solution is simple - replacing the reference value with the actual value from integers.xml, just like Apktool already does for versionName.
2019-02-20 08:26:17 -05:00
Igor Eisberg
49e55f522f
Fix APKs with SDK versions being reference values
This non-standard behavior is rare, but quite annoying.
The solution is simple - replacing the reference value with the actual value from integers.xml, just like Apktool already does for versionName.
2019-02-20 08:26:14 -05:00
Igor Eisberg
be1aea76fe
Fix reference values not being resolved against frameworks
This Apktool issue has existed for a long time and is especially prevalent with ROMs with multiple frameworks.
The issue happens because Apktool treats reference values inside XMLs (like layouts) as raw text values, and doesn't resolve them during decompile time. This causes some values to be misformed, but more importantly, this causes values referencing to secondary frameworks to not be resolved with their source frameworks, which also means the framework ID won't be added to usesFramework.ids in apktool.yml, and that breaks recompiling.
The interesting thing is that reference values are actually being resolved when they are located in value resources, like styles, thus presenting an inconsistent behavior.
This simple mod eliminates the "rawValue" for reference values, and that forces the "value" (resource ID) to resolve against the respective frameworks, fixing misformed values in the process.

BEFORE:
I: Using Apktool 2.4.0-896569-SNAPSHOT on Notes.apk
I: Loading resource table...
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (miui.system), pkgId: 18
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: bin\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Loading resource table from file: bin\framework\16.apk
I: Decoding Shared Library (androidhwext), pkgId: 15
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

Some comparisons before and after the fix:
https://i.imgur.com/2gTllT0.png
https://i.imgur.com/KzJUeQt.png

AFTER:
I: Using Apktool 2.4.0-896569-SNAPSHOT on Notes.apk
I: Loading resource table...
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (miui.system), pkgId: 18
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: bin\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Loading resource table from file: bin\framework\16.apk
I: Decoding Shared Library (androidhwext), pkgId: 15
I: Loading resource table from file: bin\framework\18.apk
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (android.miui), pkgId: 17
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
2019-02-18 06:47:09 -05:00
Connor Tumbleson
bc7302a52b
test: assert that vertical/horizontal divs are added if missing 2019-02-17 13:07:32 -05:00
IgorEisberg
1e68bb0ede
feat: Fill missing 9patch lines to fix recompile
Somehow Google manages to compile MiuiSystemUI.apk (and a few other APKs I encountered) with a misformed pip_dismiss_scrim.9.png.
Either way, every time I encountered such 9.patch images, the missing lines always indicated a single full div or padding.
Apktool already fills missing padding lines, now it can also fill missing divs.
2019-02-16 18:52:34 -05:00
IgorEisberg
0efccc2d93
feat: allow configurable api-level for smali 2019-02-16 18:43:25 -05:00
Connor Tumbleson
91f6c80cc6
fix: add new aapt builds for mac 2019-02-16 18:01:38 -05:00
Connor Tumbleson
a9b5f7b41d
fix: add new unix builds for master aosp aapt 2019-02-16 18:01:38 -05:00
Connor Tumbleson
b0f22918cc
fix: win builds off master branch of AOSP 2019-02-16 18:01:38 -05:00
Connor Tumbleson
2253b66e50
fix: rebuild windows binaries to fix linking issue 2019-02-16 18:01:38 -05:00
Vincent Barthelemy
13e356f2ef fix: use the res type spec name to create res bag value
Starting with the version 28.0.3 of the Android SDK build tools,
the internal ids of the items of an array bag seems to have changed.

Because of those changes, array resources were no longer decoded correctly.
They were decoded as style resources.

Instead of using the id of the first item within a resource bag,
the name of the res type spec is now used to choose the correct
resource bag value to create.

Note: a list of "legal names" for resource types  can be found in the source code of aapt2.
2019-01-29 10:07:40 +01:00
Vincent Barthelemy
72368fc0d4 bug: reproduce the bug were array resources are decoded as style bag 2019-01-29 10:06:32 +01:00
Connor Tumbleson
6d1792a98d fix: add headless call in beginning of execution
- fixes: #1997
2019-01-25 15:42:07 -05:00
Connor Tumbleson
cfea3e0831 build: initial attempt at getting travis windows support
build: force windows onto the bash environment

build: update permission (+x) of clean-test file

build: "bat" instead of "exe" extension

build: attempt to support long-path names on windows

build: another attempt at long filepaths on windows

build: force +x on scripts prior to execution

build: exit with return code of last command

build: dump out current path

build: dump out current path - part 2

fix: remove 5 chars from path to drop down from 260 windows max path

build: correct gradlew.bat path and remove unneeded lines

fix: remove long path global configuration

fix: restore PATH setting for windows env

build: PATH resets between scripts, fix for windows
2019-01-09 17:43:40 -05:00
Connor Tumbleson
016dc25fa9
Merge branch 'master' into master 2019-01-09 17:18:19 -05:00
Connor Tumbleson
45152c269a refactor: use specific exceptions when decoding raw xml 2019-01-09 17:11:51 -05:00
Connor Tumbleson
c1f50a2810 style: remove unused LOGGER for PullStreamDecoder 2019-01-09 17:11:32 -05:00
Connor Tumbleson
6bb73b509d fix: throw specific errors during XMLPullParser error 2019-01-09 17:10:56 -05:00
Connor Tumbleson
ac3518e098 feat: add new exception types 2019-01-09 17:10:21 -05:00
Sebastian Rasmussen
b01dce7f3a Adapt AXMLResourceParser to handle broken headers.
Fixes #1976.
2019-01-08 21:20:50 +01:00
Connor Tumbleson
c833a32a6e style: syntax changes for review 2019-01-04 18:05:51 -05:00
Connor Tumbleson
39faff0a21 test: allow aapt2 xsd test to run 2019-01-04 18:00:33 -05:00
Connor Tumbleson
7cd8946849 fix: fallback to raw decoder if xml decoder failed
- prevents injection of false value
2019-01-04 18:00:19 -05:00
Connor Tumbleson
a5cfe41a8f test: add test for aapt1/aapt2
- ignore aapt2 due to failure
2019-01-04 17:45:51 -05:00
Connor Tumbleson
af4a506567 fix: add aapt1/aapt2 xsd file 2019-01-04 17:45:36 -05:00
Connor Tumbleson
ec0d58fbad feat: add 32/64bit binaries for aapt1/aapt2 2019-01-04 11:24:28 -05:00
Connor Tumbleson
f997e0aff1 fix: patch out bools on ResBooleans, as they must be empty
- refs: #1918
2019-01-03 16:57:23 -05:00
Connor Tumbleson
0dfa6c4656 test: add test to ensure empty ids.xml are generated for aapt1/aapt2 2019-01-03 16:56:25 -05:00
Connor Tumbleson
127192e07d build: add new patched aapt1 version for mac 2018-12-18 18:19:24 -05:00
Connor Tumbleson
bec8778d7a tests: update platformBuild* values to inherit from AndroidManifest 2018-12-18 18:07:40 -05:00
Connor Tumbleson
b0a7e64615 refactor: flatten directory structure of aapt binaries by 1 directory 2018-12-18 17:36:34 -05:00
Connor Tumbleson
e82537e340 Merge branch 'no-crunch-aapt-option' of https://github.com/Novex/Apktool 2018-12-18 16:24:27 -05:00
a-bahmani
db553ebe8d
Fix null pointer
When I am decompiling an apk, I got this exception:
Exception in thread "main" java.lang.NullPointerException
        at brut.androlib.res.data.ResResSpec.<init>(ResResSpec.java:42)
2018-12-17 23:42:28 +03:30
Connor Tumbleson
83f5b21574
fix: use striped symbols build of aapt.exe 2018-09-05 19:31:07 -04:00
Connor Tumbleson
e752ebf8ff
build: update aapt1/2 builds for darwin 2018-09-02 10:01:33 -04:00
Connor Tumbleson
859b7c6d3f
test: updates aapt2 tests to handle the new "compileSdk" attributes 2018-09-02 09:55:49 -04:00
Connor Tumbleson
da133f482f
build: add aapt2 for win/unix 2018-09-02 09:55:36 -04:00
Connor Tumbleson
7a481f68e0
test: updates aapt1 tests to handle the new "compileSdk" attributes 2018-09-02 09:39:07 -04:00
Connor Tumbleson
b49bba19e4
test: don't enforce attribute order or compare attributes that don't exist 2018-09-02 09:37:59 -04:00
Connor Tumbleson
846d6a783a
build: add win/unix aapt1 builds
- refs: https://github.com/iBotPeaches/platform_frameworks_base/commits/apktool_9.0.0
2018-09-02 09:37:37 -04:00
Connor Tumbleson
3f85dfa6c9 fix: revert change that enforced "STRINGPOOL_TYPE" on StringPool
- fixes: #1876
2018-08-23 17:14:38 -04:00
Connor Tumbleson
b7d33cb623 style: update license headers that are missing 2018 2018-08-23 16:14:24 -04:00
Connor Tumbleson
aa0047c76c
feat: update internal freamwork to API 28 (Android Pie Final) 2018-08-07 20:52:44 -04:00
Seb Patane
b0fd764df4 feat: Expose the aapt --no-crunch option
- Add a --no-crunch/-nc flag to apktool which gets passed through to aapt
- This allows apktool to make a byte-for-byte copy of resource files
- refs: #1232
2018-07-24 13:54:37 +10:00
Connor Tumbleson
abdd536a18 test: add aapt1/aapt2 tests for "0byte" files 2018-07-20 15:21:44 -04:00
Connor Tumbleson
4bda4674f9 test: use correct "new" variable for tests 2018-07-20 15:20:39 -04:00
Alexei Khlebnikov
564b285126 fix: add file extension to doNotCompress only if the file size is not 0 2018-07-19 18:14:48 +02:00
Connor Tumbleson
eecfc18c82 fix: add another example aapt1 version string 2018-07-02 11:37:55 -04:00
Connor Tumbleson
985f8bb42f
feat: add new win/unix aapt2 build 2018-06-17 08:45:25 -04:00
Connor Tumbleson
925c6c0481 feat: add new mac os x aapt2 build 2018-06-14 16:36:19 -04:00
Connor Tumbleson
39ab6b636b test: add "$" leading resource test 2018-06-14 16:30:16 -04:00
Connor Tumbleson
06aa8db942
test: navigation resource test added 2018-06-12 08:22:10 -04:00
Connor Tumbleson
016fc51491
fix: add new win/unix aapt2 binaries 2018-06-12 07:10:51 -04:00
Connor Tumbleson
5eee6d2e48 fix: update aapt2 mac binary for new aosp build 2018-06-11 15:10:57 -04:00
Connor Tumbleson
5c79f4228b fix: revert the new aapt1 build. aapt1 builds are frozen 2018-05-11 13:31:08 -04:00
Connor Tumbleson
e6788f2cb4 fix: add new aapt1/aapt2 mac os x binaries 2018-05-03 15:46:05 -04:00
Connor Tumbleson
3879b90f76 test: add test for various aapt2 version strings 2018-04-19 17:10:10 -04:00
Connor Tumbleson
ba9b532283 test: add a test to confirm that mp3 file is stored (not compressed) 2018-04-12 12:00:38 -04:00
Connor Tumbleson
061ddb8ee6 fix: remove hardcoded list of no-compressed assets
- We no longer use aapt for building assets, so this code is never ran
 in aapt1/2. So we can no longer skip these assets.
2018-04-12 11:45:29 -04:00
Connor Tumbleson
6554881606 Revert "options: deprecate "doNotCompress", introduce "noCompressAssets""
This reverts commit cb6b6dfda8.
2018-04-06 14:59:10 -04:00
Connor Tumbleson
d755724ed8 Revert "decode: only store full relative path to uncompressed assets"
This reverts commit bd9c9c7cec.
2018-04-06 14:59:03 -04:00
Connor Tumbleson
a073bad32d Revert "tests: update test to use new "noCompressAssets" property"
This reverts commit 653472d006.
2018-04-06 14:58:56 -04:00
Connor Tumbleson
923ae6e9b8 Revert "tests: refactor tests to use assertEquals instead of hacky assertTrue"
This reverts commit d6e3d013e7.
2018-04-06 14:58:48 -04:00
Connor Tumbleson
4d89228686 Revert "decode: store uncompressed assets to new property"
This reverts commit 14eedde165.
2018-04-06 14:58:42 -04:00
Connor Tumbleson
0700c684b6 Revert "build: introduce "buildUnknownAndUncompressedAssets""
This reverts commit e35f66b0e0.
2018-04-06 14:58:35 -04:00
Connor Tumbleson
72196f3544 Revert "fix: normalize paths for uncompressed assets & unknown files"
This reverts commit ca25a26944.
2018-04-06 14:58:11 -04:00
Connor Tumbleson
46ebcb0fab Revert "fix: don't use deprecated property "doNotCompress""
This reverts commit 258fb82fe2.
2018-04-06 14:57:24 -04:00
Connor Tumbleson
bb42ef068e Revert "fix: Applications with implicit sdk versioning lose that information"
This reverts commit 25a164dd10.
2018-04-06 14:57:09 -04:00
Connor Tumbleson
db59f93e36 fix: ignore package "FFFFFFFFFFFFFFFFFFFFFF" to prevent wrong renaming
- refs: #1752 / #1471
2018-04-06 14:46:39 -04:00
Connor Tumbleson
041659c43f style: output "built apk" when task is completed 2018-04-06 14:03:42 -04:00
Connor Tumbleson
25a164dd10 fix: Applications with implicit sdk versioning lose that information
- This is a temporary hack to keep application building, but will not
 work due to missing nearly all resources.
 - refs: #1761
2018-04-06 14:02:41 -04:00
Connor Tumbleson
2d190d019c fix: remove 6 year old experimental smali resource tagger
- refs: #244
 - Regular expressions are not the way to fix this. Too many situations
 in smali where patterns won't work. Correct fix would be to hook dexlib
2018-04-06 12:03:08 -04:00
Connor Tumbleson
258fb82fe2 fix: don't use deprecated property "doNotCompress" 2018-04-06 10:49:08 -04:00
Connor Tumbleson
ca25a26944 fix: normalize paths for uncompressed assets & unknown files 2018-04-06 10:31:28 -04:00
Connor Tumbleson
e35f66b0e0 build: introduce "buildUnknownAndUncompressedAssets"
- processes assets that are stored (uncompressed)
 - additionally process unknown files
 - modifies application after build process
 - prevents "too long" execution command
 - fixes #1272
2018-04-05 17:07:55 -04:00
Connor Tumbleson
14eedde165 decode: store uncompressed assets to new property 2018-04-05 17:07:55 -04:00
Connor Tumbleson
d6e3d013e7 tests: refactor tests to use assertEquals instead of hacky assertTrue 2018-04-05 17:07:55 -04:00
Connor Tumbleson
653472d006 tests: update test to use new "noCompressAssets" property 2018-04-05 17:07:55 -04:00
Connor Tumbleson
bd9c9c7cec decode: only store full relative path to uncompressed assets 2018-04-05 17:07:55 -04:00
Connor Tumbleson
cb6b6dfda8 options: deprecate "doNotCompress", introduce "noCompressAssets" 2018-04-05 17:07:55 -04:00
Connor Tumbleson
e679d71615
test: rename all resources towards new location 2018-04-03 07:24:00 -04:00
Connor Tumbleson
de730ff774
test: move all resources outside of brut/apktool folder 2018-04-03 07:23:32 -04:00
Connor Tumbleson
c7ac2c05e2
update internal framework to API P (Android P Preview - x.x)
- refs: #1742
2018-03-13 11:05:15 -04:00
Connor Tumbleson
7621fdb79c Assume Android P will be API 28
- refs: #1742
2018-03-12 15:34:32 -04:00
Connor Tumbleson
1713495ea7 aapt2: move test resources to math structure of tests 2018-03-05 11:00:47 -05:00
Connor Tumbleson
a693f316e0 aapt2: add test to confirm pkgId of 0x80 2018-03-05 10:29:58 -05:00
Connor Tumbleson
722870e6b9 aapt2: don't init XMLUnit if not using the full xml diff 2018-03-05 10:29:44 -05:00
Connor Tumbleson
8ae5d529cb aapt2: patch yml files to have proper forcedPackageId param 2018-03-05 10:29:20 -05:00
Connor Tumbleson
3f8d9fa835 aapt2: patch system for decoding pkgId between 0x7f - 0xff 2018-03-05 10:28:50 -05:00
Connor Tumbleson
4403329e2e aapt2: enable --use-aapt2 command 2018-02-28 18:40:25 -05:00
Connor Tumbleson
448d14592f aapt2: don't rebuild compile stage unless needed 2018-02-28 18:40:13 -05:00
Connor Tumbleson
646eb54102 aapt2: refactor testsuite
- split from aapt1/aapt2 (those that do building)
 - tests that just test decode (no aapt) split
 - categories for androlib/encdoers/util for various others
2018-02-28 15:11:39 -05:00
Connor Tumbleson
09148902ef aapt2: start of tests for aapt2 2018-02-28 13:27:13 -05:00
Connor Tumbleson
d2c808dd7d aapt2: refactor loading of aapt/aapt2 binaries
- change: die out if invalid aapt path is provided
2018-02-28 11:25:56 -05:00
Connor Tumbleson
f05bd31e59 aapt2: sparse resource pulling from yaml 2018-02-28 11:05:07 -05:00
Connor Tumbleson
3c84590a1a aapt2: treat verbose output as fine 2018-02-28 10:58:38 -05:00
Connor Tumbleson
6f45869068 aapt2: update binaries
- refs: 595581e599
2018-02-22 11:22:41 -05:00
Connor Tumbleson
dc9d1866a5 test: rewrite test suite to use BaseTest extending 2018-02-22 11:22:41 -05:00
Connor Tumbleson
593b357ed1 support test for lib/libs folder 2018-02-22 11:22:41 -05:00
Connor Tumbleson
828ba8aef3 aapt2: kill off aapt1 testsuite, rebuild from scratch 2018-02-22 11:22:40 -05:00
Connor Tumbleson
200ad0250b aapt2: add linux/windows binaries
- very buggy
2018-02-22 11:22:40 -05:00
Connor Tumbleson
5d95b388aa aapt2: beginning use of aapt2 vs aapt1 params 2018-02-22 11:22:40 -05:00
Connor Tumbleson
5a8bc45653 aapt2: aapt2 is a staged build (compile and link).
- we destroy the "compile" stage item after a link, but keep the pending directory
 - apktool then cannot complete link stage
 - if aapt2 is used, lie to system and re-process
 - todo: rethink this
2018-02-22 11:22:40 -05:00
Connor Tumbleson
a8bdad628a aapt2: wire up zipPackage() instead of using aapt1 for final apk package 2018-02-22 11:22:40 -05:00
Connor Tumbleson
9e5df69d17 aapt2: remove unneeded newline 2018-02-22 11:22:40 -05:00
Connor Tumbleson
f5caccbc2e aapt2: flag for aapt2 and sparse resources to meta-info/apkOptions 2018-02-22 11:22:40 -05:00
Connor Tumbleson
0827b2b7a2 aapt2: read the type spec and infer if sparsely packed 2018-02-22 11:22:40 -05:00
Connor Tumbleson
88987e60b3 aapt2: Add a flag to determine if sparse resources or not 2018-02-22 11:22:40 -05:00
Connor Tumbleson
f8edbc9332 aapt2: add support for "--use-aapt2" option 2018-02-22 11:22:40 -05:00
Connor Tumbleson
f57c73d421 aapt2: copy "BuildAndDecodeTest" to aapt2 for temporary testing 2018-02-22 11:22:40 -05:00
Connor Tumbleson
ac1402aa7e aapt2: binary install for mac 2018-02-22 11:22:40 -05:00
Connor Tumbleson
34a2d03b31
Support for applications with an empty resources.arsc file
- fixes #1730
2018-02-19 06:45:48 -05:00
Connor Tumbleson
b7b449eaaf
We are ignoring typeIdOffset
- missing sample that experiences this
 - needs tests
 - samples requested: https://github.com/iBotPeaches/Apktool/issues/1728
 - refs: f90f2f8dc3
2018-02-16 08:38:07 -05:00
Connor Tumbleson
9fc1ede991
License 2018 update 2018-02-16 08:26:53 -05:00
Connor Tumbleson
1d485d21e9
cleanup formatting in smali-res-tagger
- experiment rewriting resIds in smali to remove need of public.xml
2018-02-16 08:25:34 -05:00
Connor Tumbleson
65fb5c25c2
Revert "switch to "startsWith" to stop AndroResGuard tricks"
This reverts commit c7f4dfe1db.
2018-02-13 08:47:43 -05:00
Connor Tumbleson
085e8f66ef
Switch to loop for checking extensions we are treating as raw
- 9patch (samsung)
 - regular (apple)
 - I imagine this list will grow over time
2018-02-13 08:47:02 -05:00
Connor Tumbleson
c7f4dfe1db
switch to "startsWith" to stop AndroResGuard tricks 2018-02-13 08:46:52 -05:00
Connor Tumbleson
e7d511adf8 Remove unused line
- refs: no issue
2018-02-08 15:17:51 -05:00
Connor Tumbleson
d1857102dd Add spaces where missing to make logic easier to read
- refs: no issue
2018-02-08 15:14:19 -05:00
Connor Tumbleson
bca474272e Support for rebuilding root depth kotlin folder
- refs: #1703
2018-02-07 09:42:56 -05:00
Connor Tumbleson
895af9c975 refactor test 2017-12-14 14:07:32 -05:00
Connor Tumbleson
2838d292a0 new test apk 2017-12-14 10:55:35 -05:00
Connor Tumbleson
7d22fc66b5 Initial testing of private namespace
- added sample (removed attribute names)
2017-12-14 10:55:35 -05:00
Connor Tumbleson
d46ba2fb82 add small test for #1157 2017-12-13 14:41:36 -05:00
Connor Tumbleson
b525f235f8 code style cleanup 2017-12-08 16:38:31 -05:00
Connor Tumbleson
a0cd772205 Remove duplicate manifest-only parameter 2017-12-08 16:31:25 -05:00
Nic Allen
88eed24625 Patch APKTool to allow repeated entry offsets to appear 2017-12-07 15:38:25 -08:00
Connor Tumbleson
23486830a9 Passing test for #1587
- fixes #1587
 - refs: 0fa6418553
2017-12-07 17:10:30 -05:00