launchInDefaultBrowser() crashes on Android

URL manual_url( "http://sigabort.co/Assets/doc/MIDISynth%20Circuit%20Tablet%20User%20Guide.pdf" ) manual_url.launchInDefaultBrowser()

Causes an assertion on Android in File::parseAbsolutePath, followed by a crash. This code works fine on Win, Mac, iOS

else if (! path.startsWithChar (getSeparatorChar()))
{
   #if JUCE_DEBUG || JUCE_LOG_ASSERTIONS
    if (! (path.startsWith ("./") || path.startsWith ("../")))
    {
        /*  When you supply a raw string to the File object constructor, it must be an absolute path.
            If you're trying to parse a string that may be either a relative path or an absolute path,
            you MUST provide a context against which the partial path can be evaluated - you can do
            this by simply using File::getChildFile() instead of the File constructor. E.g. saying
            "File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
            path if that's what was supplied, or would evaluate a partial path relative to the CWD.
        */
        jassertfalse;

       #if JUCE_LOG_ASSERTIONS
        Logger::writeToLog ("Illegal absolute path: " + path);
       #endif
    }
   #endif

    return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
}

This should avoid hitting the assertion:

thx - will check shortly.

Hi, still getting the crash. Does this work ok for you?

image

OK, I’ve just reverted the above commit as that seems to be the cause of the crash. After reverting it, I can open URLs using launchInDefaultBrowser() and I’m not seeing the assertion any more. Can you see if it fixes it for you?

Hi, the assertion and crash have gone, but none of the links can be opened. Confirmed that this continues to work on iOS and Mac/Win.

Are you testing this on an actual device or in the simulator? It’s working fine for me on a physical Nexus 6 but it hangs in the simulator which I think is due to a lack of internet connection.

Hi, sorry - ignore, working ok. Forgot that the router was updated here a few days ago and needed to connect to a new network.