android-sdk 2.0.1 r04下载

weixin_39820535 2019-04-24 10:00:12
android sdk 2.0.1 for windows

这个是在官方网站上下载的,如果在eclipse中开发的话还要更新
已经更新的已经上传到这里了
http://download.csdn.net/source/1957648
相关下载链接://download.csdn.net/download/renciabc/1954869?utm_source=bbsseo
...全文
24 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
详细说明参考: http://blog.csdn.net/zhenyongyuan123/archive/2010/12/07/6060900.aspx !!! Android ADT-0.9.6.zip官方下载地址: http://dl.google.com/android/ADT-0.9.6.zip Android ADT-0.9.7.zip官方下载地址: http://dl.google.com/android/ADT-0.9.7.zip Android ADT-0.9.8.zip官方下载地址: http://dl.google.com/android/ADT-0.9.8.zip Android ADT-0.9.9.zip官方下载地址: http://dl.google.com/android/ADT-0.9.9.zip Android ADT-8.0.0.zip官方下载地址: http://dl.google.com/android/ADT-8.0.0.zip 或本站下载地址: android-sdk_r05-XXX官方下载地址: (1)http://dl.google.com/android/android-sdk_r05-windows.zip (2)http://dl.google.com/android/android-sdk_r05-mac_86.zip (3)http://dl.google.com/android/android-sdk_r05-linux_86.tgz android-sdk_r08- (1)http://dl.google.com/android/android-sdk_r08-windows.zip (2)http://dl.google.com/android/android-sdk_r08-mac_86.zip (3)http://dl.google.com/android/android-sdk_r08-linux_86.tgz 下载下列文件时加前缀: https://dl-ssl.google.com/android/repository/ API 2 android-1.1_r1-windows.zip android-1.1_r1-macosx.zip android-1.1_r1-linux.zip API 3 android-1.5_r03-windows.zip android-1.5_r03-linux_x86.zip android-1.5_r03-mac_x86.zip google_apis-3-r03.zip API 4 android-1.6_r02-windows.zip android-1.6_r02-linux.zip android-1.6_r02-macosx.zip google_apis-4_r02.zip API 5 android-2.0_r01-windows.zip android-2.0_r01-linux.zip android-2.0_r01-macosx.zip google_apis-5_r01.zip API 6 android-2.0.1_r01-linux.zip android-2.0.1_r01-macosx.zip android-2.0.1_r01-windows.zip google_apis-6_r01.zip API 7 android-2.1_r01-windows.zip samples-2.1_r01-linux.zip android-2.1_r01-macosx.zip google_apis-7_r01.zip tools tools_r05-windows.zip tools_r05-linux.zip tools_r05-macosx.zip usb_d usb_driver_r03-windows.zip
Android SDK开发包国内官网下载地址.pdf 不知道是因为最近kaihui还是怎么的,打开android sdk官方网站特别的慢,想下载最新版本的platform几乎变成不可能完成的任务,不知道为什么Google不像Apache那样在各国设立镜像站。为了预防今后再出现这样的情况,这次干脆把android开发所需要的各种包总结一下,顺便提供本地下载链接,省得以后找起来麻烦。 通过分析SDK Manager里要用到的repository文件,我下载了目前google提供的各类安卓开发包并上传到了网盘。由于网盘有CDN支持,即使不用迅雷,下载速度依然很快。如果你从官网下载很慢,不妨试试这些国内链接。 注1、有些包分操作系统版本,例如windows版、macos版和linux版,下载时注意文件名里的标识。 注2、此帖长期更新,若有未及时更新的版本或失效链接,请留言通知主页君。 注2013/3/4:有一小部分下载链接失效,经查是由于未知原因被百度网盘禁止分享了,请过一段时间再试。 ADT Bundle 多合一下载包,里面包含了:sdk + 特定版本platform + eclipse + adt + 兼容包,解压缩即可使用。唯一的缺点是体积比较大,如果你是从零开始配Android开发环境就下载吧。(可惜官方提供的windows版是64位的eclipse,暂时没有32位版本,等有时间了我自己压一个。 Update2012/12/3: 官网已放出了32位版本) 文件名 文件大小 说明 其他下载地址 adt-bundle-17-windows-x86.zip 398.0M Android 4.2多合一开发包, Windows 32位。 官网 adt-bundle-17-windows-64bit.zip 398.0M Android 4.2多合一开发包, 注意所含eclipse是64位的。 官网 注:官网文件名不带版本号,应该对应“最新版”地址,下同。 adt-bundle-17-mac.zip 365.0M Mac OS 官网 adt-bundle-17-linux.zip 392.0M Linux 32位 官网 adt-bundle-linux-x86_64.zip Linux 64位 官网 假设你把sdk安装到d:\android-sdk,则里面的目录结构应该是这样的: d:\android-sdk\tools 这个目录里有ddms.bat等文件 d:\android-sdk\system-images\android-17\armeabi-v7a 这个目录里有userdata.img等文件(r14及以上才有这个目录) d:\android-sdk\platforms\android-4.0.2 这个目录里有android.jar等文件 d:\android-sdk\platform-tools 这个目录里有adb.exe等文件 d:\android-sdk\extras 这个目录里有android等目录 当你下载下面列出的部件时,也请参考上面的目录结构示例将内容放在正确的位置。 Android SDK SDK就是开发包,里面包含了两大类命令行工具:一类是SDK Tools,如android.bat、ddms.bat和emulator.exe等等,这些命令位于\tools目录,但运行仿真器所需的rom并不包含在内;另一类是Platform Tools,包含了如adb.exe、aidl.exe、aapt.exe等等命令,它们位于\platform-tools目录。 请区别清这几个名称:SDKSDK Tools、Platform Tools、Platform Package。 文件名 文件大小 说明 其他下载地址 installer_r21-windows.exe 73.9M 官方推荐下载这个安装包,是32位的 官网 android-sdk_r21-windows.zip 94.5M 文件名里虽然是"sdk",其实不含platform-tools, 叫"sdk tools"更合适。 官网 android-sdk_r21-macosx.zip 62.7M 官网 android-sdk_r21-linux.tgz 87.1M 官网 SDK安装/解压缩后,只具有基本的功能,还无法开始进行开发。你还需要platform-tools和至少一个platform package才算完整。在eclipse里通过SDK Manager是可以在线安装的,但有时手动安装也许更快。 文件名 文件大小 说明 其他下载地址 platform-tools_r14-linux.zip 10.4M 将platform-tools目录解压到sdk所在目录 官网 platform-tools_r14-macosx.zip 10.8M 官网 platform-tools_r14-windows.zip 10.6M 官网 假如你已经安装过android sdk,想单独升级tools,可以从下面的文件中选择所需要的压缩包下载,然后替换掉sdk目录下的对应子目录。 文件名 文件大小 说明 其他下载地址 tools_r20.0.3-linux.zip 78.8M 和第一个表里的"sdk"相比,只少了avd manager和sdk manager。 建议仅在需要升级时下载,用tools目录替换原来的同名目录。 官网 tools_r20.0.3-macosx.zip 55.5M 官网 tools_r20.0.3-windows.zip 86.0M 官网 ADT ADT(Android Development Tools)是一个Eclipse插件,如果没有这个插件,我们开发Android应用就得不停在命令行里敲各种命令,除非你是记事本开发狂人,否则还是老老实实享受ADT带来的方便吧。至于Eclipse本身可以去eclipse.org下载,这里就不再提供了。 文件名 文件大小 说明 其他下载地址 ADT-21.0.0.zip 12.9M 官网 ADT-20.0.3.zip 11.8M 官网 ADT-12.0.0.zip 5.4M 如果你不习惯新版的ADT,这个版本也许适合你。 官网 ADT的版本号基本上是跟着SDK Tools走,即每出一个新版本的SDK Tools,就出一个同样版本的ADT。不过实际使用中,即使是老版本的ADT也能对新版SDK支持得不错。 Platforms Android系统版本从1.0到写这篇帖子时的4.2,大大小小已经经历了10多个版本,每个版本发布时Google都会提供一个sdk platform package供开发者使用。一般这个压缩包是在Eclipse开发环境里用SDK Manager来下载的,但在国内选择这种方式会很痛苦,因为每个platform都有几十上百兆大,装一个就得几个小时,好像还不能断点续传(?)。 在国内,更方便的做法是先下载离线包,然后解压缩到android sdk的安装目录下,重启Eclipse后就会自动识别出来。 文件名 文件大小 说明 其他下载地址 android-17_r01.zip 45.6M Android 4.2 官网 sysimg_armv7a-17_r01.zip 111.0M 仅仿真器rom 官网 android-16_r03.zip 45.7M Android 4.1, 4.1.1, JELLY_BEAN 官网 sysimg_armv7a-16_r03.zip 107.0M 仅仿真器rom 官网 android-15_r03.zip 42.3M Android 4.0.3, 4.0.4, ICE_CREAM_SANDWICH_MR1 官网 sysimg_armv7a-15_r02.zip 91.7M 仅仿真器rom 官网 android-14_r03.zip 43.7M Android 4.0, 4.0.1, 4.0.2, ICE_CREAM_SANDWICH 官网 sysimg_armv7a-14_r02.zip 95.0M 仅仿真器rom 官网 android-3.2_r01-linux.zip 103.0M API Level 13, HONEYCOMB_MR2 文件名虽然有linux但其实是平台无关的,下同,直至2.1。 官网 android-3.1_r03-linux.zip 101.0M API Level 12, HONEYCOMB_MR1 官网 android-3.0_r02-linux.zip 99.6M API Level 11, HONEYCOMB 官网 android-2.3.3_r02-linux.zip 81.5M API Level 10, GINGERBREAD_MR1 官网 android-2.3.1_r02-linux.zip 75.0M API Level 9, GINGERBREAD 官网 android-2.2_r03-linux.zip 71.1M API Level 8, FROYO 官网 android-2.1_r03-linux.zip 66.8M API Level 7, ECLAIR_MR1 官网 android-2.0_r01-windows.zip 72.7M API Level 5, ECLAIR 官网 android-2.0_r01-macosx.zip 71.4M 官网 android-2.0_r01-linux.zip 71.6M 官网 android-2.0.1_r01-windows.zip 76.6M API Level 6, ECLAIR_0_1 官网 android-2.0.1_r01-macosx.zip 75.3M 官网 android-2.0.1_r01-linux.zip 75.5M 官网 android-1.6_r03-windows.zip 61.6M API Level 4, DONUT 官网 android-1.6_r03-macosx.zip 59.5M 官网 android-1.6_r03-linux.zip 60.5M 官网 android-1.5_r04-windows.zip 52.0M API Level 3, CUPCAKE 官网 android-1.5_r04-macosx.zip 50.0M 官网 android-1.5_r04-linux.zip 50.8M 官网 android-1.1_r1-windows.zip 44.6M API Level 2 官网 android-1.1_r1-macosx.zip 43.4M 官网 android-1.1_r1-linux.zip 43.3M 官网 从Level 14开始,每个platform package都被分为两部分了,一部分包含这个版本下开发所需的jar包,例如android-16_r03.zip;另一部分是仿真器rom文件,例如sysimg_armv7a-16_r03.zip。最近的版本除了arm仿真器,还有x86仿真器可供下载(由intel提供),据说在x86电脑上运行能够大幅提速。如果你只在真机上调试代码,则不需要下载仿真器rom对应的文件。 更详细的Android版本对照表可以参考这里。 Documents 供Android开发参考用的官方文档,文件比较大。我习惯有一个本地的文档,然后配合Everything使用,非常方便,文档里有很多内容源码里是没有的。 文件名 文件大小 说明 其他下载地址 docs-17_r01.zip 163.0M 官网 docs-16_r03.zip 156.0M 官网 docs-15_r02.zip 126.0M 官网 docs-14_r01.zip 104.0M 官网 Sources 我比较懒,从来没有用git下载android源代码,如果你想用git下载,可以参考这篇文章里的操作方法。 官方目前提供了一些源代码压缩包,如下表所列,这些压缩包可以attach到eclipse里方便随时F3查看;最重要的是,有了源代码以后,Eclipse里代码辅助出来的参数名再也不会是"arg0"、"arg1"这样的了。 文件名 文件大小 说明 其他下载地址 sources-17_r01.zip 18.0M 官网 sources-16_r02.zip 17.0M 官网 sources-15_r02.zip 15.7M 官网 sources-14_r01.zip 15.4M 官网 sources-8-froyo.zip 33.3M (非官方) 官网 sources_2.1.zip 30.0M (非官方) 官网 sources_1.6.zip 22.8M (非官方) 官网 Samples Google提供了丰富的开发示例,如果时间允许多看看这些例子代码和运行效果,对提升手机应用的设计开发能力肯定大有帮助。 文件名 文件大小 说明 其他下载地址 samples-17_r01.zip 14.1M 官网 samples-16_r01.zip 14.0M 官网 samples-15_r02.zip 15.6M 官网 samples-14_r02.zip 15.5M 官网 samples-3.2_r01-linux.zip 11.6M 官网 samples-3.1_r01-linux.zip 11.5M 官网 samples-3.0_r01-linux.zip 11.4M 官网 samples-2.3_r01-linux.zip 8.1M 官网 samples-2.3.3_r01-linux.zip 8.1M 官网 samples-2.2_r01-linux.zip 7.6M 官网 samples-2.1_r01-linux.zip 7.3M 官网 除了上面这些以外,还有AddOns和Supports等分类没来得及整理,等有时间了找一下。 以上内容随时补充更新,欢迎提醒和纠错。
https://github.com/iBotPeaches/Apktool Introduction Basic First lets take a lesson into apk files. apks are nothing more than a zip file containing resources and compiled java. If you were to simply unzip an apk like so, you would be left with files such as classes.dex and resources.arsc. $ unzip testapp.apk Archive: testapp.apk inflating: AndroidManifest.xml inflating: classes.dex extracting: res/drawable-hdpi/ic_launcher.png inflating: res/xml/literals.xml inflating: res/xml/references.xml extracting: resources.arsc However, at this point you have simply inflated compiled sources. If you tried to view AndroidManifest.xml. You'd be left viewing this. P4F0\fnversionCodeversionNameandroid*http://schemas.android.com/apk/res/androidpackageplatformBuildVersionCodeplatformBuildVersionNamemanifestbrut.apktool.testapp1.021APKTOOL Obviously, editing or viewing a compiled file is next to impossible. That is where Apktool comes into play. $ apktool d testapp.apk I: Using Apktool 2.0.0 on testapp.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: 1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values */* XMLs... I: Baksmaling classes.dex... I: Copying assets and libs... $ Viewing AndroidManifest.xml again results in something much more human readable android="https://schemas.android.com/apk/res/android" package="brut.apktool.testapp" platformBuildVersionCode="21" platformBuildVersionName="APKTOOL"/> In addition to XMLs, resources such as 9 patch images, layouts, strings and much more are correctly decoded to source form. Decoding The decode option on Apktool can be invoked either from d or decode like shown below. $ apktool d foo.jar // decodes foo.jar to foo.jar.out folder $ apktool decode foo.jar // decodes foo.jar to foo.jar.out folder $ apktool d bar.apk // decodes bar.apk to bar folder $ apktool decode bar.apk // decodes bar.apk to bar folder $ apktool d bar.apk -o baz // decodes bar.apk to baz folder Building The build option can be invoked either from b or build like shown below $ apktool b foo.jar.out // builds foo.jar.out folder into foo.jar.out/dist/foo.jar file $ apktool build foo.jar.out // builds foo.jar.out folder into foo.jar.out/dist/foo.jar file $ apktool b bar // builds bar folder into bar/dist/bar.apk file $ apktool b . // builds current directory into ./dist $ apktool b bar -o new_bar.apk // builds bar folder into new_bar.apk $ apktool b bar.apk // WRONG: brut.androlib.AndrolibException: brut.directory.PathNotExist: apktool.yml // Must use folder, not apk/jar file InfoIn order to run a rebuilt application. You must resign the application. Android documentation can help with this. Frameworks Frameworks can be installed either from if or install-framework, in addition two parameters -p, --frame-path - Store framework files into -t, --tag - Tag frameworks using Allow for a finer control over how the files are named and how they are stored. $ apktool if framework-res.apk I: Framework installed to: 1.apk // pkgId of framework-res.apk determines number (which is 0x01) $ apktool if com.htc.resources.apk I: Framework installed to: 2.apk // pkgId of com.htc.resources is 0x02 $ apktool if com.htc.resources.apk -t htc I: Framework installed to: 2-htc.apk // pkgId-tag.apk $ apktool if framework-res.apk -p foo/bar I: Framework installed to: foo/bar/1.apk $ apktool if framework-res.apk -t baz -p foo/bar I: Framework installed to: foo/bar/1-baz.apk Migration Instructions v2.1.1 -> v2.2.0 Run the following commands to migrate your framework directory Apktool will work fine without running these commands, this will just cleanup abandoned files unix - mkdir -p ~/.local/share; mv ~/apktool ~/.local/share windows - move %USERPROFILE%\apktool %USERPROFILE%\AppData\Local v2.0.1 -> v2.0.2 Update apktool to v2.0.2 Remove framework file $HOME/apktool/framework/1.apk due to internal API update (Android Marshmallow) v1.5.x -> v2.0.0 Java 1.7 is required Update apktool to v2.0.0 aapt is now included inside the apktool binary. It's not required to maintain your own aapt install under $PATH. (However, features like -a / --aapt are still used and can override the internal aapt) The addition of aapt replaces the need for separate aapt download packages. Helper Scripts may be found here Remove framework $HOME/apktool/framework/1.apk Eagle eyed users will notice resources are now decoded before sources now. This is because we need to know the API version via the manifest for decoding the sources Parameter Changes Smali/baksmali 2.0 are included. This is a big change from 1.4.2. Please read the smali updates here for more information -o / --output is now used for the output of apk/directory -t / --tag is required for tagging framework files -advance / --advanced will launch advance parameters and information on the usage output -m / --match-original is a new feature for apk analysis. This retains the apk is nearly original format, but will make rebuild more than likely not work due to ignoring the changes that newer aapt requires After [d]ecode, there will be new folders (original / unknown) in the decoded apk folder original = META-INF folder / AndroidManifest.xml, which are needed to retain the signature of apks to prevent needing to resign. Used with -c / --copy-original on [b]uild unknown = Files / folders that are not part of the standard AOSP build procedure. These files will be injected back into the rebuilt APK. apktool.yml collects more information than last version SdkInfo - Used to repopulate the sdk information in AndroidManifest.xml since newer aapt requires version information to be passed via parameter packageInfo - Used to help support Android 4.2 renamed manifest feature. Automatically detects differences between resource and manifest and performs automatic --rename-manifest-package on [b]uild versionInfo - Used to repopulate the version information in AndroidManifest.xml since newer aapt requires version information to be passed via parameter compressionType - Used to determine the compression that resources.arsc had on the original apk in order to replicate during [b]uild unknownFiles - Used to record name/location of non-standard files in an apk in order to place correctly on rebuilt apk sharedLibrary - Used to help support Android 5 shared library feature by automatically detecting shared libraries and using --shared-lib on [b]uild Examples of new usage in 2.0 vs 1.5.x Old (Apktool 1.5.x) New (Apktool 2.0.x) apktool if framework-res.apk tag apktool if framework-res.apk -t tag apktool d framework-res.apk output apktool d framework.res.apk -o output apktool b output new.apk apktool b output -o new.apk v1.4.x -> v1.5.1 Update apktool to v1.5.1 Update aapt manually or use package r05-ibot via downloading Mac, Windows or Linux Remove framework file $HOME/apktool/framework/1.apk Intermediate Framework Files As you probably know, Android apps utilize code and resources that are found on the Android OS itself. These are known as framework resources and Apktool relies on these to properly decode and build apks. Every Apktool release contains internally the most up to date AOSP framework at the time of the release. This allows you to decode and build most apks without a problem. However, manufacturers add their own framework files in addition to the regular AOSP ones. To use apktool against these manufacturer apks you must first install the manufacturer framework files. Example Lets say you want to decode HtcContacts.apk from an HTC device. If you try you will get an error message. $ apktool d HtcContacts.apk I: Loading resource table... I: Decoding resources... I: Loading resource table from file: 1.apk W: Could not decode attr value, using undecoded value instead: ns=android, name=drawable W: Could not decode attr value, using undecoded value instead: ns=android, name=icon Can't find framework resources for package of id: 2. You must install proper framework files, see project website for more info. We must get HTC framework resources before decoding this apk. We pull com.htc.resources.apk from our device and install it $ apktool if com.htc.resources.apk I: Framework installed to: 2.apk Now we will try this decode again. $ apktool d HtcContacts.apk I: Loading resource table... I: Decoding resources... I: Loading resource table from file: /home/brutall/apktool/framework/1.apk I: Loading resource table from file: /home/brutall/apktool/framework/2.apk I: Copying assets and libs... As you can see. Apktool leveraged both 1.apk and 2.apk framework files in order to properly decode this application. Finding Frameworks For the most part any apk in /system/framework on a device will be a framework file. On some devices they might reside in /data/system-framework and even cleverly hidden in /system/app or /system/priv-app. They are usually named with the naming of "resources", "res" or "framework". Example HTC has a framework called com.htc.resources.apk, LG has one called lge-res.apk After you find a framework file you could pull it via adb pull /path/to/file or use a file manager application. After you have the file locally, pay attention to how Apktool installs it. The number that the framework is named during install corresponds to the pkgId of the application. These values should range from 1 to 9. Any APK that installs itself as 127 is 0x7F which is an internal pkgId. Internal Frameworks Apktool comes with an internal framework like mentioned above. This file is copied to $HOME/apktool/framework/1.apk during use. Warning 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 $HOME/apktool/framework for Windows and Unix systems. Mac OS X has a slightly different folder location of $HOME/Library/apktool/framework. 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. Note Apktool has no control over the frameworks once installed, but you are free to manage these files on your own. Tagging framework files Frameworks are stored in the naming convention of: -.apk. They are identified by pkgId and optionally custom tag. Usually tagging frameworks isn't necessary, but if you work on apps from many different devices and they have incompatible frameworks, you will need some way to easily switch between them. You could tag frameworks by: $ apktool if com.htc.resources.apk -t hero I: Framework installed to: /home/brutall/apktool/framework/2-hero.apk $ apktool if com.htc.resources.apk -t desire I: Framework installed to: /home/brutall/apktool/framework/2-desire.apk Then: $ apktool d HtcContacts.apk -t hero I: Loading resource table... I: Decoding resources... I: Loading resource table from file: /home/brutall/apktool/framework/1.apk I: Loading resource table from file: /home/brutall/apktool/framework/2-hero.apk I: Copying assets and libs... $ apktool d HtcContacts.apk -t desire I: Loading resource table... I: Decoding resources... I: Loading resource table from file: /home/brutall/apktool/framework/1.apk I: Loading resource table from file: /home/brutall/apktool/framework/2-desire.apk I: Copying assets and libs... You don't have to select a tag when building apk - apktool automatically uses the same tag, as when decoding. Smali Debugging Warning SmaliDebugging has been marked as deprecated in 2.0.3, and removed in 2.1. Please check SmaliIdea for a debugger. Apktool makes possible to debug smali code step by step, watch variables, set breakpoints, etc. General information Generally we need several things to run Java debugging session: debugger server (usually Java VM) debugger client (usually IDE like IntelliJ, Eclipse or Netbeans) client must have sources of debugged application server must have binaries compiled with debugging symbols referencing these sources sources must be java files with at least package and class definitions, to properly connect them with debugging symbols In our particular situation we have: server: Monitor (Previously DDMS), part of Android SDK, standard for debugging Android applications - explained here client: any JPDA client - most of decent IDEs have support for this protocol. sources: smali code modified by apktool to satisfy above requirements (".java" extension, class declaration, etc.). Apktool modifies them when decoding apk in debug mode. binaries: when building apk in debug mode, apktool removes original symbols and adds new, which are referencing smali code (line numbers, registers/variables, etc.) Info To successfully run debug sessions, the apk must be both decoded and built in debug mode. Decoding with debug decodes the application differently to allow the debug rebuild option to inject lines allowing the debugger to identify variables and types.-d / --debug General instructions Above information is enough to debug smali code using apktool, but if you aren't familiar with DDMS and Java debugging, then you probably still don't know how to do it. Below are simple instructions for doing it using IntelliJ or Netbeans. Decode apk in debug mode: $ apktool d -d -o out app.apk Build new apk in debug mode: $ apktool b -d out Sign, install and run new apk. Follow sub-instructions below depending on IDE. IntelliJ (Android Studio) instructions In IntelliJ add new Java Module Project selecting the "out" directory as project location and the "smali" subdirectory as content root dir. Run Monitor (Android SDK /tools folder), find your application on a list and click it. Note port information in last column - it should be something like "86xx / 8700". In IntelliJ: Debug -> Edit Configurations. Since this is a new project, you will have to create a Debugger. Create a Remote Debugger, with the settings on "Attach" and setting the Port to 8700 (Or whatever Monitor said). The rest of fields should be ok, click "Ok". Start the debugging session. You will see some info in a log and debugging buttons will show up in top panel. Set breakpoint. You must select line with some instruction, you can't set breakpoint on lines starting with ".", ":" or "#". Trigger some action in application. If you run at breakpoint, then thread should stop and you will be able to debug step by step, watch variables, etc. Netbeans instructions In Netbeans add new Java Project with Existing Sources, select "out" directory as project root and "smali" subdirectory as sources dir. Run DDMS, find your application on a list and click it. Note port information in last column - it should be something like "86xx / 8700". In Netbeans: Debug -> Attach Debugger -> select JPDA and set Port to 8700 (or whatever you saw in previous step). Rest of fields should be ok, click "Ok". Debugging session should start: you will see some info in a log and debugging buttons will show up in top panel. Set breakpoint. You must select line with some instruction, you can't set breakpoint on lines starting with ".", ":" or "#". Trigger some action in application. If you run at breakpoint, then thread should stop and you will be able to debug step by step, watch variables, etc. Limitations/Issues Because IDE doesn't have full sources, it doesn't know about class members and such. Variables watching works because most of data could be read from memory (objects in Java know about their types), but if for example, you watch an object and it has some nulled member, then you won't see, what type this member is. 9Patch Images Docs exist for the mysterious 9patch images here and there. (Read these first). These docs though are meant for developers and lack information for those who work with already compiled 3rd party applications. There you can find information how to create them, but no information about how they actually work. I will try and explain it here. The official docs miss one point that 9patch images come in two forms: source & compiled. source - You know this one. You find it in the source of an application or freely available online. These are images with a black border around them. compiled - The mysterious form found in apk files. There are no borders and the 9patch data is written into a binary chunk called npTc. You can't see or modify it easily, but Android OS can as its quicker to read. There are problems related to the above two points. You can't move 9patch images between both types without a conversion. If you try and unpack 9patch images from an apk and use it in the source of another, you will get errors during build. Also vice versa, you cannot take source 9patch images directly into an apk. 9patch binary chunk isn't recognized by modern image processing tools. So modifying the compiled image will more than likely break the npTc chunk, thus breaking the image on the device. The only solution to this problem is to easily convert between these two types. The encoder (which takes source to compiled) is built into the aapt tool and is automatically used during build. This means we only need to build a decoder which has been in apktool since v1.3.0 and is automatically ran on all 9patch images during decode. So if you want to modify 9patch images, don't do it directly. Use apktool to decode the application (including the 9patch images) and then modify the images. At that point when you build the application back, the source 9patch images will be compiled. Other FAQ What about the -j switch shown from the original YouTube videos? Read Issue 199. In short - it doesn't exist. Is it possible to run apktool on a device? Sadly not. There are some incompatibilities with SnakeYAML, java.nio and aapt Where can I download sources of apktool? From our Github or Bitbucket project. Resulting apk file is much smaller than original! Is there something missing? There are a couple of reasons that might cause this. Apktool builds unsigned apks. This means an entire directory META-INF is missing. New aapt binary. Newer versions of apktool contain a newer aapt which optimizes images differently. These points might have contributed to a smaller than normal apk There is no META-INF dir in resulting apk. Is this ok? Yes. META-INF contains apk signatures. After modifying the apk it is no longer signed. You can use -c / --copy-original to retain these signatures. However, using -c uses the original AndroidManifest.xml file, so changes to it will be lost. What do you call "magic apks"? For some reason there are apks that are built using modified build tools. These apks don't work on a regular AOSP Android build, but usually are accompanied by a modified system that can read these modified apks. Apktool cannot handle these apks, therefore they are "magic". Could I integrate apktool into my own tool? Could I modify apktool sources? Do I have to credit you? Actually the Apache License, which apktool uses, answers all these questions. Yes you can redistribute and/or modify apktool without my permission. However, if you do it would be nice to add our contributors (brut.all, iBotPeaches and JesusFreke) into your credits but it's not required. Where does apktool store its framework files? unix - $HOME/.local/share/apktool mac - $HOME/Library/apktool windows - $HOME/AppData/Local/apktool Options Utility Options that can be executed at any time. -version, --version Outputs current version. (Ex: 1.5.2) -v, --verbose Verbose output. Must be first parameter -q, --quiet Quiet output. Must be first parameter -advance, --advanced Advance usage output Decode These are all the options when decoding an apk. --api The numeric api-level of the smali files to generate (defaults to targetSdkVersion) -b, --no-debug-info Prevents baksmali from writing out debug info (.local, .param, .line, etc). Preferred to use if you are comparing smali from the same APK of different versions. The line numbers and debug will change among versions, which can make DIFF reports a pain. -f, --force Force delete destination directory. Use when trying to decode to a folder that already exists --keep-broken-res - Advanced If there is an error like "Invalid Config Flags Detected. Dropping Resources...". This means that APK has a different structure then Apktool can handle. This might be a newer Android version or a random APK that doesn't match standards. Running this will allow the decode, but then you have to manually fix the folders with -ERR in them. -m, --match-original - Used for analysis Matches files closest as possible to original, but prevents rebuild. -o, --output The name of the folder that apk gets written to -p, --frame-path The folder location where framework files should be stored/read from -r, --no-res This will prevent the decompile of resources. This keeps the resources.arsc intact without any decode. If only editing Java (smali) then this is the recommend for faster decompile & rebuild -s, --no-src This will prevent the disassemble of the dex files. This keeps the apk classes.dex file and simply moves it during build. If your only editing the resources. This is recommended for faster decompile & rebuild -t, --frame-tag Uses framework files tagged via Rebuild These are all the options when building an apk. -a, --aapt Loads aapt from the specified file location, instead of relying on path. Falls back to $PATH loading, if no file found -c, --copy-original - Will still require signature resign post API18 Copies original AndroidManifest.xml and META-INF folder into built apk -d, --debug Adds debuggable="true" to AndroidManifest file. -f, --force-all Overwrites existing files during build, reassembling the resources.arsc file and classes.dex file -o, --output The name and location of the apk that gets written -p, --frame-path The location where framework files are loaded from

12,796

社区成员

发帖
与我相关
我的任务
社区描述
CSDN 下载资源悬赏专区
其他 技术论坛(原bbs)
社区管理员
  • 下载资源悬赏专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧