Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apktool Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.OptionsPanel'

I was trying to rebuild an apk using apktool (apktool-2.1.1).

Encountered an error

i) No resource found that matches the given name '@android:style/Animation.OptionsPanel'

ii)No resource found that matches the given name '@android:style/Animation.LockScreen'

Error Msg:

I: Using Apktool 2.1.1
I: Copying /home/workspace/debug/app-demo-release classes.dex file...
I: Building resources...
W: /home/workspace/debug/app-demo-release/res/values-v24/styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.OptionsPanel'.
W: 
W: /home/workspace/debug/app-demo-release/res/values-v24/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.LockScreen'.
W: 
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_1478810839657812213.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 22, --version-code, 6, --version-name, 1.0.5-debug, -F, /tmp/APKTOOL7363633357993529625.tmp, -0, arsc, -0, woff2, -0, assets/io/michaelrocks/libphonenumber/android/data/PhoneNumberAlternateFormatsProto_66, -0, arsc, -I, /home/workspace/debug/apktool/framework/1.apk, -S, /home/workspace/debug/app-demo-release/res, -M, /home/workspace/debug/app-demo-release/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:437)
    at brut.androlib.Androlib.buildResources(Androlib.java:371)
    at brut.androlib.Androlib.build(Androlib.java:281)
    at brut.androlib.Androlib.build(Androlib.java:254)
    at brut.apktool.Main.cmdBuild(Main.java:224)
    at brut.apktool.Main.main(Main.java:84)

styles.xml

<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="TextAppearance.AppCompat.Notification.Info.Media" parent="@style/TextAppearance.AppCompat.Notification.Info" />
        <style name="TextAppearance.AppCompat.Notification.Media" parent="@style/TextAppearance.AppCompat.Notification" />
        <style name="TextAppearance.AppCompat.Notification.Time.Media" parent="@style/TextAppearance.AppCompat.Notification.Time" />
        <style name="TextAppearance.AppCompat.Notification.Title.Media" parent="@style/TextAppearance.AppCompat.Notification.Title" />
        <style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored" parent="@android:style/Animation.OptionsPanel" />
        <style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" parent="@android:style/Animation.LockScreen" />
    </resources>
like image 860
Tamilan C.Periyasamy Avatar asked Mar 11 '23 01:03

Tamilan C.Periyasamy


2 Answers

remove ~/Library/apktool/ folder(Mac OS),and re-run apktool, everything will be OK.

like image 92
Daniel.W Avatar answered Apr 07 '23 05:04

Daniel.W


Based on Daniel Wang's answer, apktool's copy of the frameworks might be out of date, and removing it will re-create it with a newer SDK version at next run. The apktool documentation lists the locations, and since version 2.2.1 it also provides a new command for those:

apktool empty-framework-dir

Quoting the relevant documentation below:


Apktool has no knowledge of what version of framework resides there. It will assume its up to date, so delete the file during Apktool upgrades

Managing framework files

Frameworks are stored in different places depending on the OS in question.

  • unix - $HOME/.local/share/apktool
  • windows - %UserProfile%\AppData\Local\apktool
  • mac - $HOME/Library/apktool

If these directories are not available it will default to java.io.tmpdir which is usually /tmp. This is a volatile directory so it would make sense to take advantage of the parameter --frame-path to select an alternative folder for framework files.

Since these locations are in sometimes hidden directories, managing these frameworks becomes a challenge. A simple helper function (added in v2.2.1) allows you to run apktool empty-framework-dir to empty out frameworks.

Note Apktool has no control over the frameworks once installed, but you are free to manage these files on your own.

like image 30
Thomas Perl Avatar answered Apr 07 '23 04:04

Thomas Perl