lib/dryrun/android_project.rb in dryrun-0.5.2 vs lib/dryrun/android_project.rb in dryrun-0.5.3

- old
+ new

@@ -1,6 +1,6 @@ -require 'nokogiri' +require 'oga' require 'fileutils' require 'tempfile' require_relative 'dryrun_utils' module DryRun @@ -149,12 +149,13 @@ if !File.exist?(path_to_manifest) return false end f = File.open(path_to_manifest) - doc = Nokogiri::XML(f) + doc = Oga.parse_xml(f) + @package = get_package(doc) @launcher_activity = get_launcher_activity(doc) if !@launcher_activity return false @@ -169,18 +170,19 @@ full_path_to_launcher = "#{@package}#{@launcher_activity.gsub(@package,'')}" "#{@package}/#{full_path_to_launcher}" end def get_package(doc) - doc.xpath("//manifest").attr('package').value + doc.xpath("//manifest").attr('package').first.value end def get_launcher_activity(doc) activities = doc.css('activity') activities.each do |child| intent_filter = child.css('intent-filter') + if intent_filter != nil and intent_filter.length != 0 - return child.attr('android:name') + return child.xpath("//activity").attr("android:name").last.value end end false end end