Error 701: Unable to load file in one device, but app works fine in the other

1,071 views
Skip to first unread message
Assigned to ewpa...@gmail.com by boban...@gmail.com

Loknath Dhayal

unread,
Sep 9, 2018, 11:23:26 AM9/9/18
to MIT App Inventor Forum
Hi Team

I have built a sample app to learn the implementation of the player component in ai2. Please find below the image of the blocks.


Above is the path given for moto g5s plus (android 7.1.1), in which all the music files are stored in internal storage. When I tried to execute this in the device, I was getting Error 701 (as seen in the following image).


When I try to do the same thing with another device (Samsung GT-I8262 android 4.1.2), with its corresponding path, it works fine.

I have also tried with different combinations of the path for the first device and it produced the same error for all of them.

So, can you please guide me on this?

Thanks and Regards
Loknath

Taifun

unread,
Sep 9, 2018, 2:21:28 PM9/9/18
to MIT App Inventor Forum
try the generic path file:///mnt/sdcard/Music...
Taifun

Loknath Dhayal

unread,
Sep 10, 2018, 2:29:45 AM9/10/18
to MIT App Inventor Forum
Hi Taifun

I have just tried the mentioned path and still get the same error.

Regards
Loknath

Loddon

unread,
Sep 10, 2018, 5:08:03 AM9/10/18
to MIT App Inventor Forum
Try using a clock timer for the player, may only need 50/100Ms, just enough to give the player time to load the source.

Loknath Dhayal

unread,
Sep 10, 2018, 5:43:20 AM9/10/18
to MIT App Inventor Forum
Hi Loddon!!!

I'll try incorporating the clock timer as you suggested. But I got a question. If this would have been the case, how is it working fine with the other device?

Regards
Loknath

Loknath Dhayal

unread,
Sep 10, 2018, 9:34:28 AM9/10/18
to MIT App Inventor Forum
I tried incorporating your suggestion and it still didn't work for this device (Moto g5s plus android 7.1.1). I tried keeping only the player.source block without calling player.start to test if the source path is getting loaded, and the same error pops up. This means the path fails to get loaded into player.source..

What I don't understand is, the same thing works well with the other device (Samsung GT-I8262 android 4.1.2).

Could you please help me find out a solution for this?

Boban Stojmenovic

unread,
Sep 10, 2018, 1:01:56 PM9/10/18
to MIT App Inventor Forum
In your 7.1.1 device ensure that storage is checked for app companion or your apk.


Otherwise you can try Taifun's File Extension and use this block to check of available storage directories.


/Boban

Loknath Dhayal

unread,
Sep 11, 2018, 3:50:04 AM9/11/18
to MIT App Inventor Forum
I just looked up into the permissions like you suggested and everything seems to be fine. I rechecked the storage permission for my app. But the result is the same. Error 701 still pops up.

Taifun's file extension successfully provides me with the file path: /storage/emulated/0/Music/Happy.mp3. But the error pops up when the same path gets loaded into player.source block and this happens only with android 7.1.1 device, but not with android 4.1.2 jelly bean device.

I doubt if this path (/storage/emulated/0) is valid to be loaded into player.source block.

Please provide me your inputs.

/Loknath

Boban Stojmenovic

unread,
Sep 11, 2018, 9:19:20 AM9/11/18
to MIT App Inventor Forum
Honestly, I have no idea why but it may be device-dependent.

Have you even tried with build apk..

Also try with other components Image, Canvas, etc. so we can rule out if it's a certain component that doesn't work.

/Boban

Loknath Dhayal

unread,
Sep 11, 2018, 1:30:09 PM9/11/18
to MIT App Inventor Forum
I have tried loading the image, but the same error popped up.

/Loknath

Evan Patton

unread,
Sep 12, 2018, 1:21:25 PM9/12/18
to MIT App Inventor Forum
I don't know that it is necessarily device dependent, but more Android version dependent. More specifically, I think this is at least somewhat related to the new permissions model in Android 6+, since apps will need to specifically request permission to access "external" storage. Can you confirm whether or not you are using the "Google Play" build option?

Regards,
Evan

Loknath Dhayal

unread,
Sep 14, 2018, 2:28:18 AM9/14/18
to MIT App Inventor Forum
Hi Evan

I am not using "Google Play" build option, but just a "save .apk to my computer" option. I, too, doubt that this is, kind of, related to permissions. But all the music files are stored in "internal" storage and not the "external" storage. So, are these permissions even required for accessing internal storage?

Regards
Loknath

Loknath Dhayal

unread,
Sep 19, 2018, 12:38:55 PM9/19/18
to MIT App Inventor Forum
The app seems to work now. I figured it out. Evan seems to be correct. The problem is more related to android versions.

There was a problem in the path sourced to the player component. Android 7.0 and higher versions behave very differently than their older versions in terms of file access by a third party app. When a third party app requests for a file, a content URI is provided rather than a file URI. But the content URI cannot be edited or viewed by the user. It can be accessed with an intent only. Hence, we cannot enter/modify the source path manually into the player component for android 7 and higher versions.

I thank everyone who tried to help me.

Regards
Loknath

Evan Patton

unread,
Sep 19, 2018, 12:53:47 PM9/19/18
to MIT App Inventor Forum
It should be the case that we updated Player to handle correctly content URIs for the Google Play build. I will go back and verify.

Thanks for the report,
Evan
Reply all
Reply to author
Forward
0 new messages