network.download() Protocol not found error occurred.
response message here
“Protocol not found”
[Env]
Simulator - no error
Android device - error occurred
i think “http://” issue!
Can anybody help me?
network.download() Protocol not found error occurred.
response message here
“Protocol not found”
[Env]
Simulator - no error
Android device - error occurred
i think “http://” issue!
Can anybody help me?
What URL are you trying to reach and does it work in https?
Can you post your code where you’re calling network.download() and it’s listener function?
Thanks
Rob
local function networkListener( event )
if event.isError then
– MessageBox( event.response, red )
elseif event.phase == “began” then
elseif event.phase == “progress” then
elseif event.phase == “ended” then
end
end
local url = "https://www.youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=Gyoyz08f_O8"
local filename = “test.mp3”
network.download( url, “GET”, networkListener, {progress=true}, filename, system.DocumentsDirectory )
Try changing
network.download( url, "GET", networkListener, {progress=true}, filename, system.DocumentsDirectory )
to
network.download( url, "GET", networkListener, {progress=true, timeout=600, bodyType="binary"}, filename, system.DocumentsDirectory )
and see if that helps. The default type is “text” and an mp3 file is not a text file.
@sphere game studio, I tried your code. Unfortunately, the problem has not been solved.
Can I do the following settings for android?
[iOS build.setting]
iphone =
{
plist =
{
NSAppTransportSecurity =
{
NSAllowsArbitraryLoads = true,
}
}
}
I think it’s related to this, but I don’t know how.
Can anybody help me? ;-;
I thought I replied to this. Android does not have a concept of ATS like iOS does. You are not running into an issue where your app is trying to block you because it’s an http:// address instead of an https:// address.
I’d suggest you put a:
print( json.prettify( event ) )
At the top of your listener function to see all the information coming back from the server and share that with us. You will of course need to require the json module somewhere above your network listener function and then use “adb logcat” to capture the console log from your device to find the messages being printed out.
Rob
@rob i have no choice.
you tested this code?
local function networkListener( event )
if event.isError then
local alert = native.showAlert( “test”, event.response, { “OK” } )
elseif event.phase == “began” then
elseif event.phase == “progress” then
elseif event.phase == “ended” then
end
end
local url = "https://www.youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=Gyoyz08f_O8"
local filename = “test.mp3”
network.download( url, “GET”, networkListener, {progress=true}, filename, system.DocumentsDirectory )
It looks like there is a redirection going on…
Nexus 9: ERROR: network: Protocol not found: //w16.youtubeinmp3.com/download/get/?id=Gyoyz08f_O8&r=S1gxJgViu9lfjIVnlA3N6sUnY2pvvLm8&t=Park+Hyo+Shin+박효신_Beautiful+Tomorrow_Official+Music+Video: http://www.youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=Gyoyz08f_O8 (java.net.MalformedURLException)
Notice how http://www is turning into “//w16” with no protocol specified?
I don’t know that there is much we can do about this. Android can’t handle URL’s that don’t have a scheme/protocol at the beginning. You could reach out to the service and have them fix their redirection.
Rob
I had the same issue. I was able to fix it by changing the “GET” to “POST”. and I left everything else the same.
My issue was with in image link, hope this helps…
What URL are you trying to reach and does it work in https?
Can you post your code where you’re calling network.download() and it’s listener function?
Thanks
Rob
local function networkListener( event )
if event.isError then
– MessageBox( event.response, red )
elseif event.phase == “began” then
elseif event.phase == “progress” then
elseif event.phase == “ended” then
end
end
local url = "https://www.youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=Gyoyz08f_O8"
local filename = “test.mp3”
network.download( url, “GET”, networkListener, {progress=true}, filename, system.DocumentsDirectory )
Try changing
network.download( url, "GET", networkListener, {progress=true}, filename, system.DocumentsDirectory )
to
network.download( url, "GET", networkListener, {progress=true, timeout=600, bodyType="binary"}, filename, system.DocumentsDirectory )
and see if that helps. The default type is “text” and an mp3 file is not a text file.
@sphere game studio, I tried your code. Unfortunately, the problem has not been solved.
Can I do the following settings for android?
[iOS build.setting]
iphone =
{
plist =
{
NSAppTransportSecurity =
{
NSAllowsArbitraryLoads = true,
}
}
}
I think it’s related to this, but I don’t know how.
Can anybody help me? ;-;
I thought I replied to this. Android does not have a concept of ATS like iOS does. You are not running into an issue where your app is trying to block you because it’s an http:// address instead of an https:// address.
I’d suggest you put a:
print( json.prettify( event ) )
At the top of your listener function to see all the information coming back from the server and share that with us. You will of course need to require the json module somewhere above your network listener function and then use “adb logcat” to capture the console log from your device to find the messages being printed out.
Rob
@rob i have no choice.
you tested this code?
local function networkListener( event )
if event.isError then
local alert = native.showAlert( “test”, event.response, { “OK” } )
elseif event.phase == “began” then
elseif event.phase == “progress” then
elseif event.phase == “ended” then
end
end
local url = "https://www.youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=Gyoyz08f_O8"
local filename = “test.mp3”
network.download( url, “GET”, networkListener, {progress=true}, filename, system.DocumentsDirectory )
It looks like there is a redirection going on…
Nexus 9: ERROR: network: Protocol not found: //w16.youtubeinmp3.com/download/get/?id=Gyoyz08f_O8&r=S1gxJgViu9lfjIVnlA3N6sUnY2pvvLm8&t=Park+Hyo+Shin+박효신_Beautiful+Tomorrow_Official+Music+Video: http://www.youtubeinmp3.com/fetch/?video=http://www.youtube.com/watch?v=Gyoyz08f_O8 (java.net.MalformedURLException)
Notice how http://www is turning into “//w16” with no protocol specified?
I don’t know that there is much we can do about this. Android can’t handle URL’s that don’t have a scheme/protocol at the beginning. You could reach out to the service and have them fix their redirection.
Rob