Skip to content
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

[BUG] Unexpected element found in manifest #3427

Closed
auermich93 opened this issue Nov 14, 2023 · 1 comment · Fixed by #3429
Closed

[BUG] Unexpected element found in manifest #3427

auermich93 opened this issue Nov 14, 2023 · 1 comment · Fixed by #3429
Assignees
Milestone

Comments

@auermich93
Copy link
Contributor

Information

  1. Apktool Version (apktool -version) - 2.9.0
  2. Operating System (Mac, Linux, Windows) - Windows/Linux
  3. APK From? (Playstore, ROM, Other) - FDroid/Github-Repo
  4. Java Version (java --version) - 15.0.2

Steps to Reproduce

$ apktool d LibreNews-v1.4_debug.apk -f
I: Using Apktool 2.9.0 on LibreNews-v1.4_debug.apk
I: Loading resource table...
I: Decoding file-resources...
I: Loading resource table from file: C:\Users\Michael\AppData\Local\apktool\framework\1.apk
I: Decoding values */* XMLs...
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

$ apktool b
I: Using Apktool 2.9.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\Michael\Downloads\LibreNews-v1.4_debug\.\AndroidManifest.xml:13: error: unexpected element <fragment> found in <manifest><application>.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Michael\AppData\Local\Temp\brut_util_Jar_70039750518989853347815499463703093804.tmp, link, -o, C:\Users\Michael\AppData\Local\Temp\APKTOOL10193433216464370307.tmp, --package-id, 127, --min-sdk-version, 16, --target-sdk-version, 26, --version-code, 5, --version-name, 1.4, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, -0, arsc, -I, C:\Users\Michael\AppData\Local\apktool\framework\1.apk, --manifest, C:\Users\Michael\Downloads\LibreNews-v1.4_debug\.\AndroidManifest.xml, C:\Users\Michael\Downloads\LibreNews-v1.4_debug\.\build\resources.zip]

$ cat AndroidManifest.xml
...
<fragment android:name=".views.SettingsActivityFragment"/>
...

APK

https://github.com/tingsu/DroidDefects/raw/master/reproducible-cases/LibreNews-app.librenews.io.librenews-1.4-a/LibreNews-v1.4_debug.apk
https://github.com/tingsu/DroidDefects/raw/master/reproducible-cases/Passwordmaker-org.passwordmaker.android-1.1.11/org.passwordmaker.android_1.1.11.apk

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? YES.
  2. If you are trying to install a modified apk, did you resign it? YES.
  3. Are you using the latest apktool version? YES.

I have attached two APKs that expose the same fault but referring to two different unexpected tags in the manifest. In both cases it is a clear fault of the app developer to include tags that shouldn't be there, but since you can install and run those APKs successfully, I was wondering whether aapt2 could simply ignore those tags during building? Just to be clear by dropping those tags from the manifest one can successfully rebuild them.

@iBotPeaches
Copy link
Owner

➜  3427 apktool b LibreNews-v1.4_debug -f
I: Using Apktool v2.9.0-17-44416481-SNAPSHOT
I: Copying LibreNews-v1.4_debug classes.dex file...
I: Building resources...
W: /media/ibotpeaches/AOSP/Apktool/3427/LibreNews-v1.4_debug/AndroidManifest.xml:13: warn: unexpected element <fragment> found in <manifest><application>.
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk into: LibreNews-v1.4_debug/dist/LibreNews-v1.4_debug.apk
➜  3427 

PR above will close on merge.

@iBotPeaches iBotPeaches self-assigned this Nov 16, 2023
@iBotPeaches iBotPeaches added this to the v2.9.1 milestone Nov 16, 2023
iBotPeaches added a commit that referenced this issue Nov 16, 2023
* feat: treat warnings as warnings during aapt2 build

* test: add invalid fragment to manifest to confirm warning
iBotPeaches added a commit that referenced this issue Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants