apk = Android::Apk.new('diva-beta.apk')
apk.each_file do |name, data|
puts "#{name}: #{data.size}bytes" # puts file name and data size
# Extract icon data in Apk
icons.each do |name, data|
File.open(File.basename(name), 'wb') {|f| f.write data } # save to file.
# Extract signature and certificate information from Apk
signs = apk.signs # retrun Hash(key: signature file path, value: OpenSSL::PKCS7)
signs.each do |path, sign|
## Listing components and permissions
manifest.components.each do |c| # 'c' is Android::Manifest::Component object
puts "#{c.type}: #{c.name}"
c.intent_filters.each do |filter|
## Extract application label string
## Extract resource strings from apk
rsc.strings.each do |str|
## Parse resource file directly
rsc_data = File.open('resources.arsc', 'rb').read{|f| f.read }
rsc = Android::Resource.new(rsc_data)
## assigns readable resource id
puts rsc.find('@string/app_name') # => 'application name'
## assigns hex resource id
puts rsc.find('@0x7f040000') # => 'application name'
## you can set lang attribute.
puts rsc.find('@0x7f040000', :lang => 'ja')
## Extract dex information
### listing string table in dex
dex.strings.each do |str|
### listing all class names
dex.classes.each do |cls| # cls is Android::Dex::ClassInfo
puts "class: #{cls.name}"
cls.virtual_methods.each do |m| # Android::Dex::MethodInfo
puts "\t#{m.definition}" # puts method definition
## Parse dex file directly
dex_data = File.open('classes.dex','rb').read{|f| f.read }
dex = Android::Dex.new(dex_data)