Headdesk
Because we've all been there with Android.
headdesk
automatically detects common issues with Android APKs. These are errors that we (at Teak) commonly see in customer support. It's like unit testing for your build system.
This is output from the check that ensures that the version of the Facebook SDK (if present) has not been deprecated:
✔ Facebook SDK version (https://github.com/GoCarrot/headdesk/blob/0.5.0/docs/facebook.md)
↳ ✔ APK contains class com.facebook.FacebookSdk
↳ ✔ com.facebook.FacebookSdk contains getSdkVersion method
↳ ✔ Found Facebook SDK version 4.33.0
↳ ✔ Facebook SDK was released in the last 2 years (using 4.33.0, released 2018-05-01)
💾 {"facebook_sdk":{"major":4,"minor":33,"patch":0,"version":"4.33.0","date":"2018-05-01"}}
headdesk
can also output to JSON.
Checks
Installation
Add this line to your application's Gemfile:
gem 'headdesk'
And then execute:
$ bundle
Or install it yourself as:
$ gem install headdesk
Usage
Command line usage instruction:
$ headdesk
$ headdesk help [COMMAND]
analyze -- Analyze an APK
$ headdesk analyze [APK]
This will unpack the APK to a temporary path, analyze and print to STDOUT the results in plaintext.
For JSON output pass --json
.
$ headdesk analyze --path [path to unpacked APK]
This will analyze an already unpacked APK.
unpack -- Unpack an APK
$ headdesk unpack APK [DESTINATION]
This will unpack an APK to the specified DESTINATION, or to the current working directory.
$ headdesk unpack APK [DESTINATION] --analyze
This will unpack an APK to the specified DESTINATION, or to the current working directory, and then perform analysis.
blame -- Find Symbols Inside AAR/JAR Files
$ headdesk blame SYMBOL [PATH]
This will search for all JAR and AAR files in PATH for SYMBOL, and display matching packages and symbols.
PATH defaults to the current directory.
For JSON output pass --json
.
headdesk-lambda
You can use headdesk
easily from anywhere, without installing anything, using the hosted version.
Usage
Command line usage instruction:
Single Command:
$ curl -w "%{url_effective}" --upload-file "PATH_TO_YOUR_APK_FILE" \
-L "`curl https://headdesk.cli-apps.teak.io/v1/url`" | \
curl --data @- --retry 10 https://headdesk.cli-apps.teak.io/v1/analyze
Replace PATH_TO_YOUR_APK_FILE
with the path to the APK file you want to analyze.
What this Does
- Requests a URL to upload the APK
curl https://headdesk.cli-apps.teak.io/v1/url
- Upload the APK to that URL, and write to STDOUT the URL it just used to upload
curl -w "%{url_effective}" --upload-file "PATH_TO_YOUR_APK_FILE" -L [Result from Step 1]
- Invoke the 'analyze' endpoint, passing the result from Step 2 as the data (via reading from STDIN)
curl --data @- --retry 10 https://headdesk.cli-apps.teak.io/v1/analyze
Development
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/GoCarrot/headdesk.
License
The gem is available as open source under the terms of the MIT License.
Apktool
headdesk
uses Apktool, without modifications.