[Android Q&A, Help & Troubleshooting] Jeffm83:
I am trying to recompile an APK of kodi. I keep getting this mess of code while using apktool and cant figure out how to correct the problem. I originally thought it was something I had done wrong in the editing process so to double check instead of editing anything I simply decompiled the original APK and tried to recompile without touching any of the files and I still receive this error. Any help is much appreciated. Thank you!

Microsoft Windows [Version 6.3.9600]

(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Jeff\Desktop\YazooStructures\apk\ForkingTool\APK>apktool b a -o a.apk

I: Using Apktool 2.1.1

I: Checking whether sources has changed...

I: Smaling smali folder into classes.dex...

I: Checking whether resources has changed...

I: Building resources...

W: ERROR: Unknown option '--forced-package-id'

W: Android Asset Packaging Tool

W:

W: Usage:

W: aapt l[ist] [-v] [-a] file.{zip,jar,apk}

W: List contents of Zip-compatible archive.

W:

W: aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]

W: badging Print the label and icon for the app declared in APK.

W: permissions Print the permissions from the APK.

W: resources Print the resource table from the APK.

W: configurations Print the configurations in the APK.

W: xmltree Print the compiled xmls in the given assets.

W: xmlstrings Print the strings of the given compiled xml assets.

W:

W: aapt p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \

W: [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \

Exception in thread "main" W: [--debug-mode] [--min-sdk-version VAL] [--

target-sdk-version VAL] \

W: [--app-version VAL] [--app-version-name TEXT] [--custom-package VAL]

\

brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.Br

utException: could not exec (exit code = 2): [aapt, p, --forced-package-id, 127,

--min-sdk-version, 21, --target-sdk-version, 22, --version-code, 1760000, --ver

sion-name, 17.6, -F, C:\Users\Jeff\AppData\Local\Temp\APKTOOL1726186263921521136

5.tmp, -0, arsc, -0, properties, -0, woff2, -0, swf, -0, zip, -0, txt, -0, asset

s/addons/script.module.pil/lib/EGG-INFO/zip-safe, -0, py, -0, xml, -0, pth, -0,

arsc, -I, C:\Users\Jeff\apktool\framework\1.apk, -S, C:\Users\Jeff\Desktop\Yazoo

Structures\apk\ForkingTool\APK\a\res, -M, C:\Users\Jeff\Desktop\YazooStructures\

apk\ForkingTool\APK\a\AndroidManifest.xml]

at brut.androlib.Androlib.buildResourcesFull(Androlib.java:437)

at brut.androlib.Androlib.buildResources(Androlib.java:371)

at brut.androlib.Androlib.build(Androlib.java:281)

at brut.androlib.Androlib.build(Androlib.java:254)

at brut.apktool.Main.cmdBuild(Main.java:224)

at brut.apktool.Main.main(Main.java:84)

Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not

exec (exit code = 2): [aapt, p, --forced-package-id, 127, --min-sdk-version, 21

, --target-sdk-version, 22, --version-code, 1760000, --version-name, 17.6, -F, C

:\Users\Jeff\AppData\Local\Temp\APKTOOL17261862639215211365.tmp, -0, arsc, -0, p

roperties, -0, woff2, -0, swf, -0, zip, -0, txt, -0, assets/addons/script.module

.pil/lib/EGG-INFO/zip-safe, -0, py, -0, xml, -0, pth, -0, arsc, -I, C:\Users\Jef

f\apktool\framework\1.apk, -S, C:\Users\Jeff\Desktop\YazooStructures\apk\Forking

Tool\APK\a\res, -M, C:\Users\Jeff\Desktop\YazooStructures\apk\ForkingTool\APK\a\

AndroidManifest.xml]

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav

a:436)

at brut.androlib.Androlib.buildResourcesFull(Androlib.java:423)

... 5 more

Caused by: brut.common.BrutException: could not exec (exit code = 2): [aapt, p,

--forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 22, --ver

sion-code, 1760000, --version-name, 17.6, -F, C:\Users\Jeff\AppData\Local\Temp\A

PKTOOL17261862639215211365.tmp, -0, arsc, -0, properties, -0, woff2, -0, swf, -0

, zip, -0, txt, -0, assets/addons/script.module.pil/lib/EGG-INFO/zip-safe, -0, p

y, -0, xml, -0, pth, -0, arsc, -I, C:\Users\Jeff\apktool\framework\1.apk, -S, C:

\Users\Jeff\Desktop\YazooStructures\apk\ForkingTool\APK\a\res, -M, C:\Users\Jeff

\Desktop\YazooStructures\apk\ForkingTool\APK\a\AndroidManifest.xml]

at brut.util.OS.exec(OS.java:95)

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav

a:430)

... 6 more

W: [--rename-manifest-package PACKAGE] \

W: [--rename-instrumentation-target-package PACKAGE] \

W: [--utf16] [--auto-add-overlay] \

W: [--max-res-version VAL] \

W: [-I base-package [-I base-package ...]] \

W: [-A asset-source-dir] [-G class-list-file] [-P public-definitions-fi

le] \

W: [-S resource-sources [-S resource-sources ...]] [-F apk-file]

[-J R-file-dir] \

W: [--product product1,product2,...] \

W: [raw-files-dir [raw-files-dir] ...]

W:

W: Package the android resources. It will read assets and resources that are

W: supplied with the -M -A -S or raw-files-dir arguments. The -J -P -F and -

R

W: options control which files are output.

W:

W: aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 ...]

W: Delete specified files from Zip-compatible archive.

W:

W: aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]

W: Add specified files to Zip-compatible archive.

W:

W: aapt v[ersion]

W: Print program version.

W:

W: Modifiers:

W: -a print Android-specific data (resources, manifest) when listing

W: -c specify which configurations to include. The default is all

W: configurations. The value of the parameter should be a comma

W: separated list of configuration values. Locales should be specified

W: as either a language or language-region pair. Some examples:

W: en

W: port,en

W: port,land,en_US

W: If you put the special locale, zz_ZZ on the list, it will perform

W: pseudolocalization on the default locale, modifying all of the

W: strings so you can look for strings that missed the

W: internationalization process. For example:

W: port,land,zz_ZZ

W: -d one or more device assets to include, separated by commas

W: -f force overwrite of existing files

W: -g specify a pixel tolerance to force images to grayscale, default 0

W: -j specify a jar or zip file containing classes to include

W: -k junk path of file(s) added

W: -m make package directories under location specified by -J

W: -u update existing packages (add new, replace older, remove deleted files

)

W: -v verbose output

W: -x create extending (non-application) resource IDs

W: -z require localization of resource attributes marked with

W: localization="suggested"

W: -A additional directory in which to find raw asset files

W: -G A file to output proguard options into.

W: -F specify the apk file to output

W: -I add an existing package to base include set

W: -J specify where to output R.java resource constant definitions

W: -M specify full path to AndroidManifest.xml to include in zip

W: -P specify where to output public resource definitions

W: -S directory in which to find resources. Multiple directories will be sc

anned

W: and the first match found (left to right) will take precedence.

W: -0 specifies an additional extension for which such files will not

W: be stored compressed in the .apk. An empty string means to not

W: compress any files at all.

W: --debug-mode

W: inserts android:debuggable="true" in to the application node of the

W: manifest, making the application debuggable even on production devices

.

W: --min-sdk-version

W: inserts android:minSdkVersion in to manifest. If the version is 7 or

W: higher, the default encoding for resources will be in UTF-8.

W: --target-sdk-version

W: inserts android:targetSdkVersion in to manifest.

W: --max-res-version

W: ignores versioned resource directories above the given value.

W: --values

W: when used with "dump resources" also includes resource values.

W: --version-code

W: inserts android:versionCode in to manifest.

W: --version-name

W: inserts android:versionName in to manifest.

W: --custom-package

W: generates R.java into a different package.

W: --auto-add-overlay

W: Automatically add resources that are only in overlays.

W: --rename-manifest-package

W: Rewrite the manifest so that its package name is the package name

W: given here. Relative class names (for example .Foo) will be

W: changed to absolute names with the old package so that the code

W: does not need to change.

W: --rename-instrumentation-target-package

W: Rewrite the manifest so that all of its instrumentation

W: components target the given package. Useful when used in

W: conjunction with --rename-manifest-package to fix tests against

W: a package that has been renamed.

W: --product

W: Specifies which variant to choose for strings that have

W: product variants

W: --utf16

W: changes default encoding for resources to UTF-16. Only useful when AP

I

W: level is set to 7 or higher where the default encoding is UTF-8.

W: --non-constant-id

W: Make the resources ID non constant. This is required to make an R java

class

W: that does not contain the final value but is used to make reusable com

piled

W: libraries that need to access resources.

C:\Users\Jeff\Desktop\YazooStructures\apk\ForkingTool\APK>