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] Apktool not/improperly handling namespaces in xml files #2793

Closed
karimbenammar opened this issue Apr 1, 2022 · 1 comment
Closed

Comments

@karimbenammar
Copy link

karimbenammar commented Apr 1, 2022

Information

  1. Apktool Version (apktool -version) - v2.6.1 (latest)
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - Playstore

Stacktrace/Logcat

Below are the logs when running the command apktool d file.apk --only-main-classes , there's already this warning Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x7d020000

I: Using Apktool 2.6.1 on com.netflix.mediaclient_8.23.0_build_12_40200.apk
I: Loading resource table...
I: Decoding Shared Library (com.netflix.mediaclient.partnermodule), pkgId: 125
I: Decoding Shared Library (com.netflix.mediaclient.partnermodule), pkgId: 125
W: Skipping package group: com.netflix.mediaclient.partnermodule
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\imenp\AppData\Local\apktool\framework\1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x7d020000
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes4.dex...
I: Baksmaling classes5.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory

Steps to Reproduce

  1. apktool d file.apk --only-main-classes

APK

If this APK can be freely shared, please upload/attach a link to it.
The APK can be downloaded from APKMirror using this link

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? - Yes, apktool fails to rebuild because of the broken xml resources
  2. Are you using the latest apktool version? - Yes

Problem

Right after decompiling the .APK, resources, especially layouts, are missing the namespace in front of each attribute.
For example, instead of having android:layout_width or android:layout_height, there's only layout_width or layout_height, without the appropriate namespace.
Here's an example right after decompilation:

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.FitWindowsLinearLayout orientation="vertical" id="@id/2131427389" fitsSystemWindows="true" layout_width="fill_parent" layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <androidx.appcompat.widget.ViewStubCompat id="@id/2131427403" layout="@layout/2131623940" inflatedId="@id/2131427402" layout_width="fill_parent" layout_height="wrap_content" />
    <include layout="@layout/2131623956" />
</androidx.appcompat.widget.FitWindowsLinearLayout>

In the example I mentioned, the only defined namespace in that file is android so manually adding android: can fix the issue.
However, in some files there are custom namespaces such as app, in that case it is a bit of a problem to know where and when to replace with android: or app:.
I don't know exactly if this problem is related to the warning mentioned in the logs earlier but right now I am clueless as to why this is happening with this apk file.

@iBotPeaches
Copy link
Owner

Sorry for delay. So a few things going on here.

So I'm going to treat this part of either #2514/#2960 and close it out.

@iBotPeaches iBotPeaches closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants