-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] Attribute android:graph not found #3533
Comments
How come I've never heard of |
Is there any way I can fix by myself, for example build resource without checking the error? |
Sure - remove all those attributes the framework doesn't know about. A hacky workaround, but it might work. |
Confirmed, I'll investigate if bug or a new framework. |
Appears to be a bug. We have a situation where the resource namespaces are stripped, like so.
Apktool falls back to the default namespace (android) when it cannot find one as shown here: https://github.com/iBotPeaches/Apktool/blob/master/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java#L321-L327 So I believe we are improperly treating it as an Android attribute, when it might be a local attribute. We do have 2 namespaces in this file leveraged, so either Apktool has a bug when parsing the namespace stack or this isn't possible and we must first check if we find a valid resource in android (framework), otherwise fall back to the first non-android namespace. |
I took a look at this some more. While the namespace uri was stripped, the prefix wasn't. So I should be able to maintain a common pool of URIs to match up the respective prefixes in combination with that is already detected.
|
I see a bug - we are mixing up offset/index when resolving a non-main uri/prefix for the namespaces. I should have a fix within a week. |
Haven't been able to pinpoint how this is occurring yet. So ignore my notes as I leave reminders for myself for next time.
So after hitting the include, which is improperly associated with the android namespace, instead of app. We see
Its a new element, so our index starts at 0, thus offset is 0. This becomes 16 which is The file
|
and sadly my attempt to replicate fails - it correctly decodes. <?xml version="1.0" encoding="utf-8"?>
<navigation android:id="@null" app:startDestination="@id/nav_home"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<include app:graph="@navigation/desktop_navigation" />
<fragment android:label="@string/menu_home" android:name="com.ibotpeaches.issue3533_2.ui.home.HomeFragment" android:id="@id/nav_home" />
<fragment android:label="@string/menu_gallery" android:name="com.ibotpeaches.issue3533_2.ui.gallery.GalleryFragment" android:id="@id/nav_gallery" />
<fragment android:label="@string/menu_slideshow" android:name="com.ibotpeaches.issue3533_2.ui.slideshow.SlideshowFragment" android:id="@id/nav_slideshow" />
</navigation> Somehow this application stripped the ending namespace declaration which has thrown off the detection of namespaces when assigning them. |
@REAndroid - could I pick your brain with this? Looking at file
Apktool is doing (wrongly) <?xml version="1.0" encoding="utf-8"?>
<navigation id="@id/nav_graph_delivery" android:startDestination="@id/blankFragment" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<include android:graph="@navigation/nav_graph_delivery_confirmation" /> ApkEditor is doing it right (?), but introduces a new prefix I can't follow. <?xml version='1.0' encoding='utf-8' ?>
<navigation android:id="@id/nav_graph_delivery" courier:startDestination="@id/blankFragment" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:courier="http://schemas.android.com/apk/res-auto">
<include courier:graph="@navigation/nav_graph_delivery_confirmation" /> Best I can tell in some research is I have some oddities around start/end namespace as well as dealing with a null one. Could you help me understand how you got |
This comment was marked as outdated.
This comment was marked as outdated.
ARSCLib/APKEditor resolves NS prefix on package name suffix rather than relying on uri last path segment. I don't remember where I read it but last segment of NS uri is referring package name.
Parsing uri for prefix might cause problems on building specially for multi-package resources, and also proguard/others are stripping away namespaces |
Thanks @REAndroid - makes sense. The application ended in I assume you did that instead of hard-coding "app" to workaround multi-package resources. |
Information
apktool -version
) - 2.9.3java --version
) - 17.0.6Stacktrace/Logcat
Steps to Reproduce
Frameworks
If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(
.apks
that live in/system/framework
or/system/priv-app
)No
APK
If this APK can be freely shared, please upload/attach a link to it.
https://install.appcenter.ms/orgs/hockeyapp-z6mg/apps/roadrunner/distribution_groups/all-users-of-roadrunner
Questions to ask before submission
apktool d
,apktool b
without changing anything? YesThe text was updated successfully, but these errors were encountered: