Category Archives: Uncategorized

iPhone Simulator problem – Corrupted Device

The system I inherited kicks off builds via Jenkins, so I saw this error in the Jenkins output

An error was encountered processing the command (code=146):
Unable to erase contents and settings in current state: Creating
10:40:48   355) Business-Cards samples Batch 15 Business-Cards sample 355: biz-card-martin_0128.JPG
10:40:48      Failure/Error: Appium::Driver.new(desired_caps).start_driver
10:40:48      Selenium::WebDriver::Error::WebDriverError:
10:40:48        Command failed: /bin/sh -c xcrun simctl erase 8EFADEC6-6E22-482A-9810-5B0822653235
10:40:48        An error was encountered processing the command (code=146):
10:40:48        Unable to erase contents and settings in current state: Creating
10:40:48      # ./image_library_tests/image_library_regression.rb:67:in `block (4 levels) in <top (required)>'
  • This means the virtual device, got corrupted and needs to removed and added back in, doing it command line often doesn’t work.
    1. Go to the VM in question, launch the iPhone simulator.  You will probably get a pop up (the “device” trying to display with a message notification that has the unable to erase message.
    2. Switch to a different device, by going to the menu for the Simulator and clicking on Hardware -> Devices and choosing any other device.
    3. Then go to Hardware -> Devices -> Manage Devices (button of the device list)
    4. When the pop up appears, select the problem device and choose delete (if you son’t switch devices first (step 2) this device will be active and you can’t delete it)
    5. Then hit the plus key “+” (at the bottom) and then create a new version of the device you just deleted (in my case I had to delete an iPhone 6 and create a new iPhone 6)
    6. You’re done, just update any files that might use the unique identifier in them
Advertisements

Error: SecurityException while injecting event

When trying to run a simple monkey script, I ran into:

** Permissions error starting activity #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.mycompany
.app/.LoginActivity; end
** Error: SecurityException while injecting event.
Events injected: 1
:Dropped: keys=0 pointers=0 trackballs=0 flips=0
## Network stats: elapsed time=56ms (0ms mobile, 0ms wifi, 56ms not connected)
// Monkey finished

This translate into not being able to use Monkey anymore to test my app (one of the down falls of having a new developer but from an outside company take over the Android app)

From Stackoverflow I found this comment

Normally, you can’t do this, for obvious security reasons. However, if this is for test purposes, you might find the Activity Testing documentation useful.

So I am moving on to investigating other options for automation