[Android Q&A, Help & Troubleshooting] chankruze:
When ever i start compiling with apktool it always gives error,no matter whether it is a system app or normal app.

I want to remove ads in shareit & home screen feed and some annoying things.

After doing all modification i encounter comilation error.

Therefore i delete every thing clean the pc re install JDK,do decompile & it was successful but this time i did nothing modification.Just decompile & recompile.But same error.

C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs>apktool b shareitoriginal
I: Using Apktool 2.2.2
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec: [aapt, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 19, --version-code, 4040058, --version-name, 4.0.58_ww, --no-version-vectors, -F, C:\Users\CHANDU\AppData\Local\Temp\APKTOOL9574286527521199604.tmp, -0, webp, -0, ini, -0, arsc, -I, C:\Users\CHANDU\AppData\Local\apktool\framework\1.apk, -S, C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs\shareitoriginal\res, -M, C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs\shareitoriginal\AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:477)
at brut.androlib.Androlib.buildResources(Androlib.java:411)
at brut.androlib.Androlib.build(Androlib.java:310)
at brut.androlib.Androlib.build(Androlib.java:263)
at brut.apktool.Main.cmdBuild(Main.java:227)
at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec: [aapt, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 19, --version-code, 4040058, --version-name, 4.0.58_ww, --no-version-vectors, -F, C:\Users\CHANDU\AppData\Local\Temp\APKTOOL9574286527521199604.tmp, -0, webp, -0, ini, -0, arsc, -I, C:\Users\CHANDU\AppData\Local\apktool\framework\1.apk, -S, C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs\shareitoriginal\res, -M, C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs\shareitoriginal\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:440)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:463)
... 5 more
Caused by: brut.common.BrutException: could not exec: [aapt, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 19, --version-code, 4040058, --version-name, 4.0.58_ww, --no-version-vectors, -F, C:\Users\CHANDU\AppData\Local\Temp\APKTOOL9574286527521199604.tmp, -0, webp, -0, ini, -0, arsc, -I, C:\Users\CHANDU\AppData\Local\apktool\framework\1.apk, -S, C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs\shareitoriginal\res, -M, C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs\shareitoriginal\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:97)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:434)
... 6 more
Caused by: java.io.IOException: Cannot run program "aapt": CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at brut.util.OS.exec(OS.java:90)
... 7 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(Unknown Source)
at java.base/java.lang.ProcessImpl.start(Unknown Source)
... 10 more

Note that decompilation was always error less.

C:\Users\CHANDU\Documents\APK Easy Tool\1-Decompiled APKs>apktool d shareitoriginal.apk
I: Using Apktool 2.2.2 on shareitoriginal.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\CHANDU\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

So can somebody tell me why this error is occuring ?