class DeviceAPI::Android::AAPT

Namespace for all methods encapsulating aapt calls

Public Class Methods

aapt_available?() click to toggle source

Check to ensure that aapt has been setup correctly and is available @return (Boolean) true if aapt is available, false otherwise

# File lib/device_api/android/aapt.rb, line 15
def self.aapt_available?
  result = execute('which aapt')
  result.exit == 0
end
get_app_props(apk) click to toggle source

Gets properties from the apk and returns them in a hash @param apk path to the apk @return (Hash) list of properties from the apk

# File lib/device_api/android/aapt.rb, line 23
def self.get_app_props(apk)
  raise StandardError.new('aapt not found - please create a symlink in $ANDROID_HOME/tools') unless aapt_available?
  result = execute("aapt dump badging #{apk}")

  fail result.stderr if result.exit != 0

  result.stdout.scan(/(.*): (.*)/).map { |a,b| { a => Hash[b.split(' ').map { |c| c.tr('\'','').split('=') }] } }
end