"fruitstrap quit unexpectedly" on Yosemite

When i run tests on iOS the “fruitstrap quit unexpectedly” popup prompts.
i have checked it on 2 different Yosemite 10.10.1 & 10.10.2 & the same error displays.
when i run the same code over Mavericks 10.9.5 it works without any errors.
*when posted this at first i got verification from more users that encountered this issue.

Environment:
Framework: Eclipse
Server: Appium 1.3.3
Mac: Yosemite 10.10.1 & 10.10.2

2 Likes

I have analysed it. The crash happened for me during the check whether the app installed or not:

fruitstrap isInstalled --id --bundle

The crash caused by uncaught exception generated by assertion:
assert(false); //(320 line)

So if the app is not installed the fruitstrap process is killed.
From my perspective if there is no app installed on iDevice it does not mean that the fruitstrap process should be mandatory crashed - “There is no app installed!\n” console log probably enought.

So I would recommend to remove the assertion (I commented the line), recompile the tool and replace it in the Appium bundle here:
/Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap

Code snippet from fruitstrap source:

    CFURLRef checkAppExists(AMDeviceRef device)
     {
        CFDictionaryRef result;
        CFURLRef url = NULL;
        assert(AMDeviceLookupApplications(device, 0, &result) == 0);
        CFStringRef identifier = CFStringCreateWithCString(NULL, app_path, kCFStringEncodingASCII);
        
        CFDictionaryRef app_dict = CFDictionaryGetValue(result, identifier);
        if(operation == OP_ISINSTALLED && app_dict == NULL) {
            PRINT("There is no app installed!\n");
            
//TODO: to be removed
//        assert(false); 
        }
        else if(operation == OP_ISINSTALLED && app_dict != NULL) {
            PRINT("App is installed!\n");
        }
        if (app_dict != NULL)
        {
            CFStringRef app = CFDictionaryGetValue(app_dict, CFSTR("Path"));
            
            if( app != NULL)
            {
                url = CFURLCreateWithFileSystemPath(NULL, app, kCFURLPOSIXPathStyle, true);
            }
            
        }
        
        CFRelease(result);
        return url;
    }
1 Like

will this fix be available in the next version?

I don’t know. I use appium for 3 days from the start, so I am a newcomer J I have not contributed into the project yet. There are a lot of fruitstrap project forks. It’s not clear which one is used by appium. Probably it makes sense to find some guy who’s maintain this part of appium. Are there such guys on this forum?

How can I edit the appium fruitstrap file, if it is an unix executable one?I`ve tried to open it with TextEdit.

@dany
you don’t open the app eg. executable
you have to either clone the repository for fruitstrap or download it as a zip.
then you go to the fruitstrap.c file (open it with xcode, textwrangler etc.) and look for the code snippet @botov provided and change the code.
after that you just compile the file and replace it in the appium’s build folder

@botov thank you for the solution! it drove me nuts!

Hey guys, can you provide the fruitstrap repository you took the change from, or better yet, could you post a link to the fixed file, please?

Hello Everyone,
I am very new with Appium, I have install appium 1.5.3 on my mac 10.11.6, after configuration with my android app, I click lunch button and then I click on Inspector button, suddenly it show the Inspector but it disappear quickly in just 1 or 2 seconds and message popped up that “Appium quit unexpectedly”.
Any suggestion or help!! I stuck in this problem two days already.
Thanks in advance,