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

Unable to recompile "Mediatek-res.apk" on Ulefone Paris - Android 5.1 #1119

Closed
cuvetto opened this Issue Dec 31, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@cuvetto

cuvetto commented Dec 31, 2015

I can decompile the file "Mediatek-res.apk" (associated with the "framework-res.apk" of the same firmware), but when I compile it again, I get numerous errors.
In this link below, you can find "framework-res.apk" and "mediatek-res.apk"
https://goo.gl/wBv7aQ

@iBotPeaches iBotPeaches added the Bug label Jan 4, 2016

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Jan 4, 2016

Owner

Not sure why this happens. The resources mentioned are indeed there as both ids.xml (to reserve an id as these values might be referenced before initialized) and included in public.xml.

Not sure.

Owner

iBotPeaches commented Jan 4, 2016

Not sure why this happens. The resources mentioned are indeed there as both ids.xml (to reserve an id as these values might be referenced before initialized) and included in public.xml.

Not sure.

@cuvetto

This comment has been minimized.

Show comment
Hide comment
@cuvetto

cuvetto Jan 13, 2016

Thanks.... I hope you can solve this bug, very soon....are you tring to solve yet??

cuvetto commented Jan 13, 2016

Thanks.... I hope you can solve this bug, very soon....are you tring to solve yet??

@sergio151179

This comment has been minimized.

Show comment
Hide comment
@sergio151179

sergio151179 Apr 18, 2016

This bug and lenovo-res.apk compile error #989, are the same bug. This present from the sdk 21, but in the sdk 21 could be used to compile aapt 4.4.1 KitKat and failure would disappear. This ruling affects many people, you could give some priority. Thank you.

This bug and lenovo-res.apk compile error #989, are the same bug. This present from the sdk 21, but in the sdk 21 could be used to compile aapt 4.4.1 KitKat and failure would disappear. This ruling affects many people, you could give some priority. Thank you.

@sergio151179

This comment has been minimized.

Show comment
Hide comment
@sergio151179

sergio151179 Apr 18, 2016

I think the bug is in ResourceTable.cpp of aapt source, here:

uint32_t ResourceTable::getResId(const String16& package,
                                 const String16& type,
                                 const String16& name,
                                 bool onlyPublic) const
{
    uint32_t id = ResourceIdCache::lookup(package, type, name, onlyPublic);
    if (id != 0) return id;     // cache hit

    // First look for this in the included resources...
    uint32_t specFlags = 0;
    uint32_t rid = mAssets->getIncludedResources()
        .identifierForName(name.string(), name.size(),
                           type.string(), type.size(),
                           package.string(), package.size(),
                           &specFlags);
    if (rid != 0) {
        if (onlyPublic) {
            if ((specFlags & ResTable_typeSpec::SPEC_PUBLIC) == 0) {
                return 0;
            }
        }

        return ResourceIdCache::store(package, type, name, onlyPublic, rid);
    }

    sp<Package> p = mPackages.valueFor(package);
    if (p == NULL) return 0;
    sp<Type> t = p->getTypes().valueFor(type);
    if (t == NULL) return 0;
    sp<ConfigList> c = t->getConfigs().valueFor(name);
    if (c == NULL) {
        if (type != String16("attr")) {
            return 0;
        }
        t = p->getTypes().valueFor(String16(kAttrPrivateType));
        if (t == NULL) return 0;
        c = t->getConfigs().valueFor(name);
        if (c == NULL) return 0;
    }
    int32_t ei = c->getEntryIndex();
    if (ei < 0) return 0;

    return ResourceIdCache::store(package, type, name, onlyPublic,
            getResId(p, t, ei));
}

sergio151179 commented Apr 18, 2016

I think the bug is in ResourceTable.cpp of aapt source, here:

uint32_t ResourceTable::getResId(const String16& package,
                                 const String16& type,
                                 const String16& name,
                                 bool onlyPublic) const
{
    uint32_t id = ResourceIdCache::lookup(package, type, name, onlyPublic);
    if (id != 0) return id;     // cache hit

    // First look for this in the included resources...
    uint32_t specFlags = 0;
    uint32_t rid = mAssets->getIncludedResources()
        .identifierForName(name.string(), name.size(),
                           type.string(), type.size(),
                           package.string(), package.size(),
                           &specFlags);
    if (rid != 0) {
        if (onlyPublic) {
            if ((specFlags & ResTable_typeSpec::SPEC_PUBLIC) == 0) {
                return 0;
            }
        }

        return ResourceIdCache::store(package, type, name, onlyPublic, rid);
    }

    sp<Package> p = mPackages.valueFor(package);
    if (p == NULL) return 0;
    sp<Type> t = p->getTypes().valueFor(type);
    if (t == NULL) return 0;
    sp<ConfigList> c = t->getConfigs().valueFor(name);
    if (c == NULL) {
        if (type != String16("attr")) {
            return 0;
        }
        t = p->getTypes().valueFor(String16(kAttrPrivateType));
        if (t == NULL) return 0;
        c = t->getConfigs().valueFor(name);
        if (c == NULL) return 0;
    }
    int32_t ei = c->getEntryIndex();
    if (ei < 0) return 0;

    return ResourceIdCache::store(package, type, name, onlyPublic,
            getResId(p, t, ei));
}
@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Apr 18, 2016

Owner

I'm not sure what a cache pool on a getResId would have to do with this bug, but I appreciate any effort towards finding a solution.

Owner

iBotPeaches commented Apr 18, 2016

I'm not sure what a cache pool on a getResId would have to do with this bug, but I appreciate any effort towards finding a solution.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Jan 15, 2017

Owner
➜  Bug1119 apktool if framework-res.apk -t 1119
apktooI: Framework installed to: /home/ibotpeaches/.local/share/apktool/framework/1-1119.apk
➜  Bug1119 apktool d mediatek-res.apk -f -t 1119
I: Using Apktool 2.2.2-b60db0-SNAPSHOT on mediatek-res.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1-1119.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
➜  Bug1119 apktool b mediatek-res
I: Using Apktool 2.2.2-b60db0-SNAPSHOT
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'AP_confirm_default_network' has no default translation.
...
I: Building apk file...
I: Copying unknown files/dir...
➜  Bug1119 

Confirmed fixed from work in iBotPeaches/platform_frameworks_base#2
Will be in 2.2.2

Owner

iBotPeaches commented Jan 15, 2017

➜  Bug1119 apktool if framework-res.apk -t 1119
apktooI: Framework installed to: /home/ibotpeaches/.local/share/apktool/framework/1-1119.apk
➜  Bug1119 apktool d mediatek-res.apk -f -t 1119
I: Using Apktool 2.2.2-b60db0-SNAPSHOT on mediatek-res.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1-1119.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
➜  Bug1119 apktool b mediatek-res
I: Using Apktool 2.2.2-b60db0-SNAPSHOT
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'AP_confirm_default_network' has no default translation.
...
I: Building apk file...
I: Copying unknown files/dir...
➜  Bug1119 

Confirmed fixed from work in iBotPeaches/platform_frameworks_base#2
Will be in 2.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment