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] Element type "manifest" must be followed by either attribute #2972

Closed
fquero47 opened this issue Dec 29, 2022 · 7 comments · Fixed by #3234
Closed

[BUG] Element type "manifest" must be followed by either attribute #2972

fquero47 opened this issue Dec 29, 2022 · 7 comments · Fixed by #3234
Assignees
Milestone

Comments

@fquero47
Copy link

fquero47 commented Dec 29, 2022

Information

  1. **Apktool Version 2.7.0-
  2. **Operating System: Linux, Windows -
  3. **APK From? Playstore ** -

Stacktrace/Logcat

WINDOWS

C:\Users\ferna> apktool d -f base.apk
I: Using Apktool 2.7.0 on base.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\ferna\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
[Fatal Error] :2:39: Element type "manifest" must be followed by either attribute specifications, ">" or "/>".
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory

Linux
root@DESKTOP-QL83D43:/mnt/c/Users/ferna# apktool d -f base.apk
I: Using Apktool 2.7.0 on base.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /root/.local/share/apktool/framework/1.apk
I: Regular manifest package...
[Fatal Error] :2:39: Element type "manifest" must be followed by either attribute specifications, ">" or "/>".

Steps to Reproduce

  1. apktool d -f base.apk

APK

If this APK can be freely shared, please upload/attach a link to it.

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?
    N/A
  3. Are you using the latest apktool version?
    YES
    base.zip
@fquero47
Copy link
Author

fquero47 commented Dec 29, 2022

Element type "manifest" must be followed by either attribute specifications, ">" or "/>".

Manifest and XML files are decoding witouth many of the attribute names..

@iBotPeaches
Copy link
Owner

Confirming something is odd with these files. Vaguely remember an existing bug about this, but will mark as bug for now until I find it.

➜  2972 aapt2 dump xmltree base.apk --file AndroidManifest.xml
N: android=http://schemas.android.com/apk/res/android (line=0)
  E: manifest (line=0)
    A: http://schemas.android.com/apk/res/android:versionCode(0x0101021b)=23608
    A: (0x0101021c)="2.36.8" (Raw: "2.36.8")
    A: (0x01010572)=30
    A: (0x01010573)="11" (Raw: "11")
    A: package="com.bcp.innovacxion.yapeapp" (Raw: "com.bcp.innovacxion.yapeapp")
    A: platformBuildVersionCode=30
    A: platformBuildVersionName=11
      E: uses-sdk (line=0)
        A: (0x0101020c)=21
        A: (0x01010270)=30
      E: supports-screens (line=0)
        A: (0x0101026c)=true
        A: (0x01010284)=true
        A: (0x01010285)=true
        A: (0x01010286)=true
        A: (0x0101028d)=true
        A: (0x010102bf)=true

@iBotPeaches iBotPeaches changed the title [BUG] [BUG] Element type "manifest" must be followed by either attribute Jan 14, 2023
@iamvinny
Copy link

Same issue here

@Candas1
Copy link

Candas1 commented Apr 30, 2023

Hi, I have the same issue with Huawei Health apk.
Is there any information I can provide to help solve this issue ?

@Candas1
Copy link

Candas1 commented May 1, 2023

Nevermind, just saw Huawei apks are not supported anyway

@allandiegoasilva
Copy link

Same here, some update?

@iBotPeaches
Copy link
Owner

➜  2972 java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -jar /usr/local/bin/apktool.jar d base.apk -f -s
Listening for transport dt_socket at address: 5005
I: Using Apktool 2.8.2-22eb80-SNAPSHOT on base.apk
I: Loading resource table...
I: Decoding file-resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Decoding values */* XMLs...
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Copying raw classes.dex file...
I: Copying raw classes2.dex file...
I: Copying raw classes3.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜  2972 apktool b base --use-aapt2
I: Using Apktool 2.8.2-22eb80-SNAPSHOT
I: Copying base classes.dex file...
I: Copying base classes2.dex file...
I: Copying base classes3.dex file...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk into: base/dist/base.apk
➜  2972 

Will have a PR up shortly that on close will close this. We have the namespace stripped from attributes within namespace. This appears fine on AOSP, but during disassembly if we don't associate the namespace prefix properly - the assembly fails.

I currently have a patch that looks for the system pkgId and forces that namespace if used. I'm currently investigating if I can trust the entire system package or should scope down to just manifest attributes.

https://github.com/aosp-mirror/platform_frameworks_base/blob/master/tools/aapt/Command.cpp#L255

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.

5 participants