当前位置:   article > 正文

安卓中Settings.apk的修改_development seetings apk

development seetings apk

原文地址

先转过来,慢慢看。。。

标题:Does anyone know how to edit Settings.apk? [Solved!]

提问:

I've been trying to do this for some time, but I've hit a wall. I want to take the Settings.apk from my current rom (which ever one it happens to be). Decompile it. Edit some entries. Then recompile and sign it, so that I can use it with said rom. 

I've tried using apktool (and a few automated versions of it). It works great to decompile and recompile. I then use signapk.jar to sign the apk using a test key. But when I copy Settings.apk over to my /system/app folder, change the permissions, and reboot, the settings menu fails to load and my wallpaper disappears.

I thought that it might be edits I am making. So I tried decompiling, recompiling, and signing with no edits and I still get the same problem where the settings menu fails to load. 

I even tried following this crazy guide: [HOW-TO] Modify the Keyboard and Screen Timeouts Settings
But I had the same problem. 

I have successfully used apktool and my signing tool to edit and use other apk files. So I know that they work. Can anyone (probably a dev) explain what I'm doing wrong?

Thanks!

Update: Solution

------------------------

Originally Posted by  mmarz  View Post
Here is how you can do it yourself:
(自己翻译一下下面的步骤,水平有效,可能有出入)
  1. Download: Apk Manager 4.9 - Makes Modifying Ur Apk A Breeze (Windows/Linux) - xda-developers(下载Apk Manager工具,最新下载地址http://apkmultitool.com/?q=node/5。注意5.0是linux版本,5.0.2是Windows的版本哦)
  2. Get your Settings.apk off of your phone either with root explorer or adb:(将Settings.apk文件从手机提取出来)
    Code:
    adb pull /system/app/Settings.apk
  3. Keep a copy of Settings.apk somewhere safe.(保存一份备份,以便修改失败后再来一次)
  4. Place one copy into the "place-apk-here-for-modding" folder in apk manager.(复制一份到"place-apk-here-for-modding" 目录
  5. Run Script.bat.(运行Script.bat脚本)
  6. Enter option 22.(进入选项22-Set Current Project,将APK文件加载到当前工程)
  7. Select the Settings.apk(选择 Settings.apk)
  8. Enter option 9.(进入选项9-Decompile apk,对apk反编译)
  9. Open folder projects\Settings.apk\res\xml\(打开文件夹 projects\Settings.apk\res\xml\
  10. Open settings.xml in notepad or any other simple text editor.(用记事本或其他文本编辑工具打开 settings.xml 文件
  11. Remove these lines:(删除以下内容)
    Code:
       <com.android.settings.IconPreferenceScreen android:title="@string/privacy_settings" android:key="privacy_settings" settings:icon="@drawable/ic_settings_privacy">
            <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.android.settings.PrivacySettings" />
      </com.android.settings.IconPreferenceScreen>
  12. Save the file.(保存文件)
  13. Enter option 11 in app manager. (进入选项11-Compile apk,编译apk)
  14. Enter "y" (yes) for if this is a system apk. (输入‘y’若修改的文件是系统文件的话,此处我们输入y)
  15. Enter "y" for the next option too.(接下来还是输入‘y’)
  16. Open the newly created "keep" folder inside of your app manager folder. (在app manager目录中打开最新生成的‘keep’文件夹)
  17. Delete resources.arsc (删除 resources.arsc 文件
  18. Then delete keep\res\xml\settings.xml (接着删除 keep\res\xml\settings.xml 文件
  19. Go back to app manager and hit enter to continue. (返回 app manager 目录,输入‘回车’继续)
  20. Look inside "place-apk-here-for-modding" and find your newly created "unsignedSettings.apk" (在"place-apk-here-for-modding" 目录找到最新生成的unsignedSettings.apk"文件
  21. I used this file and it worked great. Signing it broke it for some reason. ( 我试用过这个文件,它允许的很好,对其签名时由于一些问题损坏了)
  22. Copy "unsignedSettings.apk" to the folder that contains adb.exe and rename it to "Settings.apk" (复制unsignedSettings.apk"文件到包含 adb.exe的目录然后重命名为 Settings.apk"
  23. Open command prompt and enter: (打开命令行输入以下命令:)
    Code:
    adb remount
    adb push Settings.apk /system/app/Settings.apk
    adb shell chmod 644 /system/app/Settings.apk
    adb reboot

If everything went right, your settings should load like normal but privacy should be gone now. If something went wrong, your wallpaper will be gone and settings will not load. Retrace your steps in that event. Maybe try signing the  apk. Who knows why only the unsigned version works for me?
(如果一切正常的话,你的 Settings 会开起来正常但是“隐私”项会不见了。若是操作有误的话,你的壁纸会消失,而且Settings不能加载。你要重新再进行下上面的步骤。你也可以尝试对apk签名。谁知道为什么只有未签名的版本在我这上面有效?)
-----------------------------

Thank you so much for posting this walk-through. I was trying to change the icons in the settings menu to the ICS icons and for some reason it wasn't working. After reading the walk-through (and testing) I realized it was because I was entering "n" on the second question after compiling. Now my settings menu looks awesome! 


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/458110
推荐阅读
相关标签
  

闽ICP备14008679号