The path you're feeding to Uri.fromFile is not absolute.

Make it so (by calling file.getAbsolutePath or file.getCanonicalPath) and
you should get consistent, predictable results.

-- Kostya

2011/6/5 eehouse <[email protected]>

> I've tracked a crash in my app that's only reproducible on one phone
> (that I've seen) to a strange return from Uri.fromFile().
>
> I have two identical T-Mobile LG G2X devices.  They were purchased at
> the same time.  Software version strings in Settings/About phone are
> identical.  I've hard-reset both to eliminate config differences.
> When I run my app on one, it crashes immediately 100% of the time.
> Run on the other it's fine (as it is on every other device I've tested
> on.)
>
> The function that shows the problem looks like this, after I add
> logging:
>
>    public static void launchGame( Activity activity, String path )
>    {
>        File file = new File( path );
>        Utils.logf( "file: %s", file.getPath() );
>        Uri uri = Uri.fromFile( file );
>        Utils.logf( "Uri.fromFile=>%s", uri.toString() );
>        [...]
>    }
>
> On the device where there's no crash the logs look like this:
>
> D/XW4     ( 7107): [22:59:40]-1-file: Game 1.xwg
> D/XW4     ( 7107): [22:59:40]-1-Uri.fromFile=>file:///Game%201.xwg
>
> while on the device that's about to crash I see this:
>
> D/XW4     ( 4234): [23:00:36]-1-file: Game 1.xwg
> D/XW4     ( 4234): [23:00:36]-1-Uri.fromFile=>file:///data/data/
> com.lge.providers.flex/databases/Game%201.xwg
>
> Has anybody seen this before?  Is there any chance that it's other
> than a weird bug in the phone itself?
>
> Thanks,
>
> --Eric
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to