Apktool
                                
                                
                                
                                    Apktool copied to clipboard
                            
                            
                            
                        [Compile error framework-res.apk] Resource entry Theme.Holo already has bag item textEditSuggestionItemLayout.
Information
- Apktool Version (
apktool -version) - 2.5.0 - Operating System (Mac, Linux, Windows) - Windows 10 Pro
 - APK From? (Playstore, ROM, Other) - AOSP Android 9.0 for ASUS_X00LD
 
Stacktrace/Logcat
Compiling APK file... (Press ESC to cancel)
/c "java -Xmx1024m -jar "C:\Program Files (x86)\APK Easy Tool\Apktool\apktool_2.5.0.jar" b -f -o "C:\Users\Administrator\Documents\APK Easy Tool\2-Recompiled APKs\framework-res.apk" "C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res" "
I: Using Apktool 2.5.0 W: Could not find sources I: Building resources... W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1184: error: Resource entry Theme.Holo already has bag item textEditSuggestionItemLayout. W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1183: Originally defined here. W: W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1260: error: Resource entry Theme.Holo already has bag item preferenceFrameLayoutStyle. W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1259: Originally defined here. W: W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1269: error: Resource entry Theme.Holo already has bag item textEditSuggestionContainerLayout. W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1268: Originally defined here. W: W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1271: error: Resource entry Theme.Holo already has bag item textEditSuggestionHighlightStyle. W: C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res\values\styles.xml:1270: Originally defined here. W: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\ADMINI~1\AppData\Local\Temp\brut_util_Jar_58334102865100678537102944826996642900.tmp, p, --forced-package-id, 1, --min-sdk-version, 28, --target-sdk-version, 28, --version-code, 28, --version-name, 9, --no-version-vectors, -F, C:\Users\ADMINI~1\AppData\Local\Temp\APKTOOL5357856494746311717.tmp, -x, -e, C:\Users\ADMINI~1\AppData\Local\Temp\APKTOOL9110140203189688992.tmp, -0, arsc, -S, C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\res, -M, C:\Users\Administrator\Documents\APK Easy Tool\1-Decompiled APKs\framework-res\AndroidManifest.xml] Compile successful.
Please read the FAQ and troubleshooting https://forum.xda-developers.com/t/tool-windows-apk-easy-tool-v1-57-12-june-2020.3333960/#post-65775601
Include stacktrace here
Steps to Reproduce
I used Easy APK Tool, basically what I am trying to do is changing the minimum screen brightness in the framework-res.apk. The values are in framework-res\res\values\integers.xml. Decompiling has no problem, but when I tried to recompile the APK it shows up this error. I've tried to decompile and recompile the apk without doing any changes at all, but this error shows up. I've also tried to use previous version of APK tool, and by using the CMD method but it's still showing up this error. I believe that this is a bug from the original file itself because I did not modify the file 'styles.xml'. From the issue #2290 posted by @Magendanz, it is fixed by deleting the doubled entries in the file, but I have no idea which one is it. How do I fix it?
APK
If this APK can be freely shared, please upload/attach a link to it. https://mega.nz/file/ZoMmGBza#q4uFbotDT_N2V66fXfVthqN6I9Ha-k0RYd6xvRieBAU
Questions to ask before submission
- Have you tried 
apktool d,apktool bwithout changing anything? No, - If you are trying to install a modified apk, did you resign it? No.
 - Are you using the latest apktool version? Yes.
 
@icypeach replace the original aapt's in apktool with these to work with framework-res.apk: [redacted]
# java -jar apktool_2.5.0.jar b framework-res --use-aapt2
I: Using Apktool 2.5.0
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
                                    
                                    
                                    
                                
@icypeach replace the original aapt's in apktool with these to work with framework-res.apk: [redacted]
# java -jar apktool_2.5.0.jar b framework-res --use-aapt2 I: Using Apktool 2.5.0 W: Could not find sources I: Checking whether resources has changed... I: Building resources... I: Building apk file... I: Copying unknown files/dir... I: Built apk...
I've removed the link. I don't trust sharing prebuilt binaries. Please put a pull request forward to change aapt binaries if you want to put forward a change.
@iBotPeaches I cannot check your aapt's, they do not work on my old computer, I informed you about this earlier; excluding ssse3 & sse4.1 optimization for zlib would solve the problem, but slow down performance on newer processors; external/zlib is not included in platform_frameworks_base, but is included in aapt's, so I compiled aapt's for myself separately, with the zlib patch; showed the build command and the tool it used, i.e. compiled by me aapt, so that @icypeach can check that the command with the --use-aapt2 flag really works (whether it works on yours - I don't know): I apologize for the thoughtless advice to replace aapt @icypeach
@pashamcr That's very kind of you trying to help, but nevermind I've figured myself out on how to fix it. I believe that everyone on stock AOSP 9.0 will face this problem when trying to compile the APK, as this bug is from the original file from Google itself. So here's the fix:
- 
Open the file styles.xml in \framework-res\res\values using any text editor (Windows Notepad will do)
 - 
Use the find option to find these entries: "textEditSuggestionItemLayout">@layout/text_edit_suggestion_item "preferenceFrameLayoutStyle">@style/Widget.Holo.PreferenceFrameLayout "textEditSuggestionContainerLayout">@layout/text_edit_suggestion_container "textEditSuggestionHighlightStyle">@style/TextAppearance.Holo.SuggestionHighlight
 - 
Each of these entries will have a duplicate below them, now just delete them
 - 
Save the file and try to compile the APK
 
But another problem comes after I replaced the original framework-res.apk, which is my phone stucked on black screen after reboot (It passes the bootanimation). Basically now it's on bootloop(and I don't really mind cause I've made a backup). I guess the systemui failed to launch. I've done readings on XDA and Reddit before posting this comment, and people have been saying that the modified APK should be signed. I've signed the APK and done the zipalign successfully. Where did I went wrong? And is it appropriate to ask this here, or should I close this issue and create another?
I cannot check your aapt's, they do not work on my old computer, I informed you about this earlier;
Could you put forward a patch? Its hard for me to track things that aren't a PR waiting. Just too much output.
But another problem comes after I replaced the original framework-res.apk, which is my phone stucked on black screen after reboot (It passes the bootanimation). Basically now it's on bootloop(and I don't really mind cause I've made a backup). I guess the systemui failed to launch. I've done readings on XDA and Reddit before posting this comment, and people have been saying that the modified APK should be signed. I've signed the APK and done the zipalign successfully. Where did I went wrong? And is it appropriate to ask this here, or should I close this issue and create another?
Generally the logcat will point at what went wrong, but it won't be easy to understand exactly.
I'm going to dig into why this is duping, since this is part of the resources.arsc. It won't be as easy to dump out, but seeing this:
        <item name="switchPreferenceStyle">@style/Preference.Holo.SwitchPreference</item>
        <item name="textEditSuggestionItemLayout">@layout/text_edit_suggestion_item</item>
        <item name="textEditSuggestionItemLayout">@layout/text_edit_suggestion_item</item>
        <item name="actionModeSelectAllDrawable">@drawable/ic_menu_selectall_holo_dark</item>
A clear duplicate is just strange.
i had the same issue is there no othe way to recompile it?
Resolved with: https://github.com/iBotPeaches/Apktool/commit/86340503acd4f81d8b3decc1f60f35b30faa8d72