Skip to content

kochavi-daniel/fastlane-plugin-analyze-apk

Repository files navigation

analyze_apk plugin

Getting Started

This project is a fastlane plugin. To get started with fastlane-plugin-analyze_apk, add it to your project by running:

fastlane add_plugin analyze_apk

About analyze_apk

Analyze APK extracts usefull information about your generated APK.

Options:

Key Description
apk_path Path to the apk you want to inspect
android_home Path to the root of your Android SDK installation, e.g. ~/tools/android-sdk-macosx
build_tools_version The Android build tools version to use e.g. '23.0.2'

Output variables:

SharedValue Description
ANALYZE_APK_PACKAGE_NAME APK's package name
ANALYZE_APK_VERSION_CODE APK's version code
ANALYZE_APK_VERSION_NAME APK's version name
ANALYZE_APK_APP_NAME App's name
ANALYZE_APK_MIN_SDK APK's minimal sdk version
ANALYZE_APK_SIZE APK's size (bytes)
  • You can access these values using: lane_context[SharedValues::VARIABLE_NAME]

Example

The following lane creates an apk using the gradle action then it takes the generated apk and runs analyze_apk on it (using a SharedValue set by the gradle action):

fastlane_version "2.39.2"

default_platform :android

platform :android do

  desc "Create an apk and print information about it"
  lane :apk do
    gradle( #builds your apk
      task: "assembleRelease"
    )
    analyze_apk(
      android_home: 'path/to/your/Android/sdk',
      build_tools_version: '23.0.2',
      apk_path: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
    )
    puts("Version name: #{lane_context[SharedValues::ANALYZE_APK_VERSION_NAME]}")
    puts("Package name: #{lane_context[SharedValues::ANALYZE_APK_PACKAGE_NAME]}")
    puts("Version code: #{lane_context[SharedValues::ANALYZE_APK_VERSION_CODE]}")
    puts("App name: #{lane_context[SharedValues::ANALYZE_APK_APP_NAME]}")
    puts("Minimum sdk: #{lane_context[SharedValues::ANALYZE_APK_MIN_SDK]}")
    puts("Apk size: #{lane_context[SharedValues::ANALYZE_APK_SIZE]} bytes")
  end
end

Issues and Feedback

For any other issues and feedback about this plugin, please submit it to this repository.

Troubleshooting

If you have trouble using plugins, check out the Plugins Troubleshooting guide.

Using fastlane Plugins

For more information about how the fastlane plugin system works, check out the Plugins documentation.

About fastlane

fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out fastlane.tools.