Hello guys,
On my app I need to use a fetch to get data from the server.
The issue is that when I’m using my Android 4.2.2, the fetch fails.
As an example to test this I’ve used the Fetching JSON example with some console.log()
:
<App Background="#eee">
<DockPanel>
<StatusBarBackground Dock="Top" />
<BottomBarBackground Dock="Bottom" />
<ScrollView>
<Grid ColumnCount="2">
<JavaScript>
var Observable = require("FuseJS/Observable");
var data = Observable();
fetch('https://gist.githubusercontent.com/petterroea/5ed146454706990ea8386f147d592eff/raw/b157cfed331da3cb88150051ab74aa131022fef8/colors.json')
.then(function(response) {
console.log("1-------------------------------------");
console.log(JSON.stringify(response));
return response.json();
}).then(function(responseObject) {
console.log("2-------------------------------------");
console.log(JSON.stringify(responseObject));
data.replaceAll(responseObject);
}).catch(function(error) {
console.log("3-------------------------------------");
console.log("error " + error);
return error;
});
module.exports = {
data: data
};
</JavaScript>
<Each Items="{data}">
<DockPanel Height="120" Margin="10">
<Panel DockPanel.Dock="Top" Margin="10" Height="30">
<Rectangle Layer="Background" CornerRadius="10" Color="#fff"/>
<Text Value="{colorName}" TextAlignment="Center" Alignment="Center" />
</Panel>
<Rectangle Layer="Background" CornerRadius="10" Color="{hexValue}"/>
</DockPanel>
</Each>
</Grid>
</ScrollView>
</DockPanel>
</App>
This example only fails on the Android version 4.2.2 with this log:
D/OpenGLRenderer(10741): Enabling debug mode 0
D/dalvikvm(10741): create interp thread : stack size=32KB
D/dalvikvm(10741): create new thread
D/dalvikvm(10741): new thread created
D/dalvikvm(10741): update thread list
D/dalvikvm(10741): threadid=12: interp stack at 0x57503000
D/dalvikvm(10741): threadid=12: created from interp
D/dalvikvm(10741): start new thread
D/dalvikvm(10741): threadid=12: notify debugger
D/dalvikvm(10741): threadid=12 (AsyncTask #1): calling run()
I/SurfaceView(10741): Changes: creating=true format=true size=true visible=true left=true top=true mUpdateWindowNeeded=false mReportDrawNeeded=false redrawNeeded=false forceSizeChanged=true mVisible=false mRequestedVisible=true
I/SurfaceView(10741): Cur surface: Surface(name=null, identity=-1)
V/SurfaceView(10741): android.view.SurfaceView{42382358 V.E..... ......ID 0,0-800,1280} got resized: w=800 h=1280, cur w=-1 h=-1
I/SurfaceView(10741): New surface: Surface(name=null, identity=134), vis=true, frame=Rect(0, 0 - 800, 1280)
I/SurfaceView(10741): visibleChanged -- surfaceCreated
I/SurfaceView(10741): surfaceChanged -- format=4 w=800 h=1280
I/SurfaceView(10741): surfaceRedrawNeeded
I/SurfaceView(10741): finishedDrawing
V/SurfaceView(10741): Layout: x=0 y=0 w=800 h=1280, frame=Rect(0, 0 - 800, 1280)
V/InputMethodManager(10741): onWindowFocus: com.foreign.Fuse.Android.AppRoot$1{42380568 VFE..... .F....I. 0,0-800,1280} softInputMode=272 first=true flags=#1810100
V/InputMethodManager(10741): START INPUT: com.foreign.Fuse.Android.AppRoot$1{42380568 VFE..... .F....I. 0,0-800,1280} ic=null tba=android.view.inputmethod.EditorInfo@423a47d0 controlFlags=#105
V/InputMethodManager(10741): Starting input: Bind result=InputBindResult{null com.nuance.xt9.input/.IME #56}
I/SurfaceView(10741): Changes: creating=false format=false size=false visible=false left=false top=false mUpdateWindowNeeded=true mReportDrawNeeded=true redrawNeeded=false forceSizeChanged=false mVisible=true mRequestedVisible=true
I/SurfaceView(10741): Cur surface: Surface(name=null, identity=134)
I/SurfaceView(10741): New surface: Surface(name=null, identity=134), vis=true, frame=Rect(0, 0 - 800, 1280)
I/SurfaceView(10741): surfaceRedrawNeeded
I/SurfaceView(10741): finishedDrawing
V/SurfaceView(10741): Layout: x=0 y=0 w=800 h=1280, frame=Rect(0, 0 - 800, 1280)
D/libc-netbsd(10741): getaddrinfo: gist.githubusercontent.com NO result from proxy
D/libc-netbsd(10741): res_queryN name = gist.githubusercontent.com, class = 1, type = 1
D/libc-netbsd(10741): res_queryN name = gist.githubusercontent.com., class = 1, type = 1
V/InputMethodManager(10741): focusOut: com.foreign.Fuse.Android.AppRoot$1{42380568 VFE..... ........ 0,0-800,1280} mServedView=com.foreign.Fuse.Android.AppRoot$1{42380568 VFE..... ........ 0,0-800,1280} winFocus=true
V/InputMethodManager(10741): START INPUT: com.foreign.Fuse.Android.AppRoot$1{42380568 VFE..... ......ID 0,0-800,1280} ic=null tba=android.view.inputmethod.EditorInfo@423a84a8 controlFlags=#100
V/InputMethodManager(10741): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@423a8d38 com.nuance.xt9.input/.IME #57}
I/System.out(10741): [CDS][DNS]Unable to resolve host "gist.githubusercontent.com": No address associated with hostname
D/HttpJson(10741): 3-------------------------------------
D/HttpJson(10741): error TypeError: Network request failed
However, in my app, this error also is shown in the device with version 4.4.2.
Has anyone have had any similar issue?
- Fuse version: v1.5.0 (build 15046)
- Operating system version: macOS HighSierra 10.13.3
- The devices I’m using for this test:
- Asus MemoPad HD 7 with Android 4.2.2
- Zopo ZP999 with Android 4.4.2
- OnePlus 3 with Android 8.0
- Unknown brand/model with Android 5.1.1
- Samsung Galaxy A5 (2016), Android 7.0
Thanks in advance.