Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch not working on Android 9 API 28 #24627

Closed
mttrthomazelli opened this issue Apr 26, 2019 · 130 comments
Closed

Fetch not working on Android 9 API 28 #24627

mttrthomazelli opened this issue Apr 26, 2019 · 130 comments
Labels
Bug 🌐Networking Related to a networking API. Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@mttrthomazelli
Copy link

mttrthomazelli commented Apr 26, 2019

🐛 Bug Report

Hello,

I'm having an Issue about a HTTP service (the error only in simulator with API 28 (Pie) environment). I already add the domain on react_native_config.xml and add the networkSecurityConfig on both Manifests.xml (debug and release) but still get the TypeError: Network request failed error:

I already try all this Issues: #23986, #23984

My info:
info
React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
Memory: 318.58 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.8.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 25, 26, 27, 28
Build Tools: 25.0.0, 25.0.1, 26.0.2, 27.0.3, 28.0.3
System Images: android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.2/10P91b - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.0 => 0.59.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

My react_native_config.xml:


acolhebrasil.com.br

localhost 10.0.2.2 10.0.3.2

My fetch:
fetch(baseURLAPI + action, {
method: method,
headers: headers,
body: bodyObj ? JSON.stringify(bodyObj) : null
}).then((response) => {
console.log(response)
if(response.ok){
return response.json();
}
throw new Error(response.text());
})
.then((responseJson) => {
console.log(responseJson)
if(callbackSuccess){
return callbackSuccess(responseJson);
}
})
.catch((error) => {
console.log(error)
if(callbackError){
return callbackError(error);
}
});
My API: http://acolhebrasil.com.br/Sistema/api/login/

Console:
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (ReactNativeRenderer-dev.js:3731)
at XMLHttpRequest.dispatchEvent (ReactNativeRenderer-dev.js:10394)
at XMLHttpRequest.setReadyState (ReactNativeRenderer-dev.js:10127)
at XMLHttpRequest.__didCompleteResponse (ReactNativeRenderer-dev.js:9895)
at ReactNativeRenderer-dev.js:10051
at RCTDeviceEventEmitter.emit (blob:http://localhost:8081/9854a9b9-407d-4571-8675-e6fadd170803:3282)
at MessageQueue.__callFunction (ReactNativeART.js:13)
at blob:http://localhost:8081/9854a9b9-407d-4571-8675-e6fadd170803:2336
at MessageQueue.__guard (ReactNativeART.js:10)
at MessageQueue.callFunctionReturnFlushedQueue (blob:http://localhost:8081/9854a9b9-407d-4571-8675-e6fadd170803:2335)

@react-native-bot react-native-bot added Platform: Android Android applications. 🌐Networking Related to a networking API. labels Apr 26, 2019
@andresmtz98
Copy link

Same here. There is an exception called "NoSuchKeyException" when use fetch api (it's only as release).

@mttrthomazelli
Copy link
Author

I tried now to change fetch to axios, same error. I believe that is an Android security configuration missing ou somenthing like.

@andresmtz98
Copy link

andresmtz98 commented Apr 26, 2019

I tried now to change fetch to axios, same error. I believe that is an Android security configuration missing ou somenthing like.

It seems that the solution for now is to rollback my RN project (from last version .59.5) to .58 :/, but i'm using hooks :(

@0xDub
Copy link

0xDub commented Apr 29, 2019

Same issue here, have you found any better solutions by any chance? I'm running RN 0.58.3 for reference

@andresmtz98
Copy link

See this #24361

@codypearce
Copy link

Same here on 0.58.6.

I have tried network_security_config.xml as described here #22375
As well as a android:usesCleartextTraffic="true" as described here #23986
Also tried axios
Still getting the same error

I use http://localhost:5000 for the local api.

@hey99xx
Copy link

hey99xx commented May 1, 2019

On latest RN 0.59.x, all http connections should be doable in debug apps, and https should only be enforced in release apps.

If issue is related to network_security_config, using XMLHttpRequest/fetch/axios won't matter.
They will all go through RN's networking native module, which uses OkHttp that checks if Android app allows insecure connections and will be blocked there.

I don't know about NoSuchKeyException related to this, please copy paste an entire stack trace.

Also version numbers reported here by multiple people are conflicting, please clearly write
- what RN version (0.57, 0.58, 0.59) you're testing with, preferably with minor releases like 0.59.0, 0.59.1 etc.
- if you use debug vs release apks
- Android API version
to better understand what the issue is and possibly find a culprit in commit history quicker.

@mrkacan
Copy link

mrkacan commented May 2, 2019

You need to use "https" when fetching something. Installing SSL certificate and enabling https link solved my issue. (I did try Android 9.0, axios is working, fetch is working.)

@codypearce
Copy link

@mrkacan Many people use localhost for their api in development and many also do not have their localhost setup with https yet. I think this is a common enough use case that it should be supported.

@zhigang1992
Copy link
Contributor

Are you able to access the api from chrome browser? localhost on Android emulator is not the same as the host. You might need to do a adb reverse for it to work

@mohsenomidi
Copy link

Hi
same issue here!

for testing purposes, we are using http for fetch data to our test physical mobile devices, if react-native block this capability, in our test environments we should install more than one ssl certificate and it made complex routines for internal tests.
i completely agree for security reasons in production environment the users must use https, but the liability shift will not take by development languages it should not force the devopers to use single security option, for example, if some programming languages declined the udp connection beacuse it is not reliable for some reasons, it will not be acceptable.

it doesn't make sense to prevent using http in development level, some use cases and some business may use http, without any security becase the net work is private and ssl encapsulation will made the request/response too slow.

i think this rule must be add in devoploment and business level not in development languages level.

Regards.

@mohsenomidi
Copy link

Hi All,

I found a work around solution for Http (non HTTPS) fetch :
Add the codes in your main AndroidManifest.xml

<manifest xmlns:tools="http://schemas.android.com/tools"> .... <application android:usesCleartextTraffic="true" tools:targetApi="28"> ... </application> </manifest>

@mmihic96
Copy link

mmihic96 commented Jun 3, 2019

@mohsenomidi
Thank You very much. That worked for me!

@igorserafim
Copy link

igorserafim commented Jun 7, 2019

Hi All,

I found a work around solution for Http (non HTTPS) fetch :
Add the codes in your main AndroidManifest.xml

<manifest xmlns:tools="http://schemas.android.com/tools"> .... <application android:usesCleartextTraffic="true" tools:targetApi="28"> ... </application> </manifest>

That worked for me too. Thanks! @mohsenomidi

I was having the same problem OP had, but using axios and having just updated my cordova android platform to the newest one.

@mathosmor
Copy link

mathosmor commented Jun 12, 2019

@mohsenomidi That worked for me too :)

@hohien
Copy link

hohien commented Jun 14, 2019

@mohsenomidi You save my life today, Thanks

@MobileDevStar
Copy link

Thanks for your help

Hi All,

I found a work around solution for Http (non HTTPS) fetch :
Add the codes in your main AndroidManifest.xml

<manifest xmlns:tools="http://schemas.android.com/tools"> .... <application android:usesCleartextTraffic="true" tools:targetApi="28"> ... </application> </manifest>

@amohit1315
Copy link

is the issue solved for https??

Trying to fetch data from remote server via api.
Using fetch(https:url:port) to fetch the data. But every time android emulator as well as physical device gives network request failed. While I can access same url within browser of emulator.

I have already went through various links, and many people have posted same problem but none of them had ample solution that works. While some people were not able to access localhost via api-call but it was resolved using IP address of system. But in my scenario I am trying to access remote host. Also domain name cannot be used in my scenario, so need a solution using (ip) in fetch method=get.

testlogin = https://10.209.7.115:8080/api/v1/
Basicauth = 'Basic cm9vdDpyb290'

fetch(testingLogin, {
method: "GET",
cache: "no-cache",
mode: "cors",
withCredentials: true,
credentials: "include",
headers: {
'Authorization':Basicauth,
Accept: "application/json",
"Content-Type": "application/json"
}
}).then(response =>
{
if(response.status === 200)
{
this.props.navigation.navigate('Home');
}
else
{
alert("Authorization failed");
}
})
.catch(error => {
alert("Request Failed :Check the ip address Entered:Problem with server ");
throw(error);
})

TypeError: Network request failed
onerror@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:24051:31
dispatchEvent@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:28695:31
setReadyState@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:28448:33
__didCompleteResponse@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:28275:29
emit@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:3280:42
__callFunction@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2577:49
http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2334:31
__guard@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2531:15
callFunctionReturnFlushedQueue@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2333:21

info
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 54.73 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.4.0 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 25, 27, 28, 29
Build Tools: 28.0.3, 29.0.0
System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.3 => 0.59.3
npmGlobalPackages:
react-native-background-fetch: 2.6.0
react-native-cli: 2.0.1
react-native-gesture-handler: 1.3.0

@mohsenomidi
Copy link

is the issue solved for https??

Trying to fetch data from remote server via api.
Using fetch(https:url:port) to fetch the data. But every time android emulator as well as physical device gives network request failed. While I can access same url within browser of emulator.

I have already went through various links, and many people have posted same problem but none of them had ample solution that works. While some people were not able to access localhost via api-call but it was resolved using IP address of system. But in my scenario I am trying to access remote host. Also domain name cannot be used in my scenario, so need a solution using (ip) in fetch method=get.

testlogin = https://10.209.7.115:8080/api/v1/
Basicauth = 'Basic cm9vdDpyb290'

fetch(testingLogin, {
method: "GET",
cache: "no-cache",
mode: "cors",
withCredentials: true,
credentials: "include",
headers: {
'Authorization':Basicauth,
Accept: "application/json",
"Content-Type": "application/json"
}
}).then(response =>
{
if(response.status === 200)
{
this.props.navigation.navigate('Home');
}
else
{
alert("Authorization failed");
}
})
.catch(error => {
alert("Request Failed :Check the ip address Entered:Problem with server ");
throw(error);
})

TypeError: Network request failed
onerror@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:24051:31
dispatchEvent@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:28695:31
setReadyState@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:28448:33
__didCompleteResponse@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:28275:29
emit@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:3280:42
__callFunction@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2577:49
http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2334:31
__guard@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2531:15
callFunctionReturnFlushedQueue@http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false:2333:21

info
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 54.73 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.4.0 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 25, 27, 28, 29
Build Tools: 28.0.3, 29.0.0
System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.3 => 0.59.3
npmGlobalPackages:
react-native-background-fetch: 2.6.0
react-native-cli: 2.0.1
react-native-gesture-handler: 1.3.0

@amohit1315 your issue is not related to this case you are using HTTPS and have an issue, please open another case to report your problem, the workaround solution for http fetch only has been provided in my last comment.

@Saumyadip-Pramanik
Copy link

Saumyadip-Pramanik commented Jun 25, 2019

React-Native Version: 0.59.0
Axios: 0.18.0
Not working for me! :(

Hi All,

I found a work around solution for Http (non HTTPS) fetch :
Add the codes in your main AndroidManifest.xml

<manifest xmlns:tools="http://schemas.android.com/tools"> .... <application android:usesCleartextTraffic="true" tools:targetApi="28"> ... </application> </manifest>

@draperj
Copy link

draperj commented Jun 25, 2019

Seeing the same issue using HTTPS connections via Axios and Fetch, running on Android Pie API 28.

Adding android:usesCleartextTraffic="true" to manifests does not resolve this issue.

package.json dependencies:
"dependencies": { "axios": "^0.19.0", "react": "16.8.3", "react-native": "0.59.9" }

Axios and Fetch examples:

axios.get("https://HTTPS_BASED_API_GOES_HERE").then((response) => response.json())
.then((responseJson) => {

    console.log(responseJson);
})
.catch((error) => {
    console.error("Axios error", error);
});
            
fetch("https://HTTPS_BASED_API_GOES_HERE")
.then(response => {

    console.log(response);

    this.setState({
        isLoading: false,
        recentArticles: response.recentArticles,
        tags: response.tags
    }, function () {

    });
})
.catch((error) => {
    console.error("Fetch error", error);
});

@amohit1315
Copy link

Hi Everyone,

whoever is facing this problem.
I found a get around. Hopefully someone will fix it in fetch.

Stop using fetch.

Install "'react-native-fetch-blob'"

import it in your js file as

import RNFetchBlob from 'react-native-fetch-blob';

Replace your original fetch as below code

RNFetchBlob.config({
            trusty : true // <---add this
        })
        .fetch('GET', ip1, {
        Authorization : token,
      })
      .then((response) => response.json())
    .then((responseData) => {
        console.log("responseData : " +responseData);
        return responseData
    }).catch((error) => {
        console.log("error : " +error);
        throw(error);
        return {};
    });

trust: true avoids checking for certificates.

Good luck. Comment if you found it useful or not.
All my problems are solved now and working great for both iOS and android.

@draperj
Copy link

draperj commented Jun 25, 2019

trust: true avoids checking for certificates.

This is unfortunately quite a dangerous workaround that I would not recommend. Your app should always be checking to ensure certificate are valid and not foraged.

@mohitmessi007
Copy link

True I agree....

one should always configure certificates.... My scenario was tricky because my app required fetch info from remote host...there could be a thousand or many more and each will have separate certificate

One should use this approach in desperate need only 😊

@klever34
Copy link

klever34 commented Sep 6, 2020

@HIPHOPSANDY tried that already, didn't work.

@HIPHOPSANDY
Copy link

HIPHOPSANDY commented Sep 6, 2020 via email

@klever34
Copy link

klever34 commented Sep 6, 2020

Same thing @HIPHOPSANDY

@HIPHOPSANDY
Copy link

HIPHOPSANDY commented Sep 6, 2020 via email

@klever34
Copy link

klever34 commented Sep 6, 2020

I'm not sure I understand that @HIPHOPSANDY

@erickhdzreyes
Copy link

I'm not sure I understand that @HIPHOPSANDY

Try to adding this permission at the top of the AndroidManifest.xml

@HIPHOPSANDY
Copy link

are you solved?

@blackprinceaj
Copy link

blackprinceaj commented Sep 7, 2020 via email

@philoskim
Copy link

This is my development environment.

$ react-native -v
react-native-cli: 2.0.1
react-native: 0.63.2

$ react-native info
info Fetching system and libraries information...
System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
    Memory: 2.12 GB / 7.64 GB
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 12.18.1 - ~/.local/node/bin/node
    Yarn: 1.22.5 - ~/.local/node/bin/yarn
    npm: 6.14.8 - ~/.local/node/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 14.0.2 - /usr/bin/javac
    Python: 3.7.6 - /home/philos/.local/conda/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
  npmGlobalPackages:
    *react-native*: Not Found

I solved this problem as follows.

  1. Add this one line to your android/app/src/debug/AndroidManifest.xml file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <!-- An addition starts -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- An addition ends-->

    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>
  1. Run the following adb commands before you run yarn react-native run-android,
    if you use the JavaScript function fetch('http://127.0.0.1:3000/users') in your source code.
# for metro bundler
$ adb reverse tcp:8081 tcp:8081

# for your localhost web server port
$ adb reverse tcp:3000 tcp:3000

$ yarn react-native run-android

That's it! I hope this will help you out.

@rutsatz
Copy link

rutsatz commented Dec 6, 2020

This is my development environment.

$ react-native -v
react-native-cli: 2.0.1
react-native: 0.63.2

$ react-native info
info Fetching system and libraries information...
System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
    Memory: 2.12 GB / 7.64 GB
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 12.18.1 - ~/.local/node/bin/node
    Yarn: 1.22.5 - ~/.local/node/bin/yarn
    npm: 6.14.8 - ~/.local/node/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 14.0.2 - /usr/bin/javac
    Python: 3.7.6 - /home/philos/.local/conda/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
  npmGlobalPackages:
    *react-native*: Not Found

I solved this problem as follows.

  1. Add this one line to your android/app/src/debug/AndroidManifest.xml file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <!-- An addition starts -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- An addition ends-->

    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>
  1. Run the following adb commands before you run yarn react-native run-android,
    if you use the JavaScript function fetch('http://127.0.0.1:3000/users') in your source code.
# for metro bundler
$ adb reverse tcp:8081 tcp:8081

# for your localhost web server port
$ adb reverse tcp:3000 tcp:3000

$ yarn react-native run-android

That's it! I hope this will help you out.

Thanks. It worked for me. It was missing to disable the warning.

@gvsakhil
Copy link

gvsakhil commented Feb 3, 2021

Making the backend from http to https works fine

But even after making to https I got an issue and at last I found that SSL was not configured properly

https://www.digicert.com/help/ - U can check ssl configuration is done prorperly or not using this link

SSL NOT Configured properly
Screenshot 2021-02-03 at 8 57 00 AM

SSL Configured properly
Screenshot 2021-02-03 at 8 56 48 AM

@hoaxvo16
Copy link

Hi guys, after speding many hour to research about this issue i have this solution: Using ngrok to remote to your local development. So you need:

  • Install ngrok if you are using ubuntu or debian run the following command:

    sudo apt install ngrok

  • Login and authen token to ngrok

  • Start BE server

  • Run the flowing command:

    ngrok http <your_back_end_port> --host-header="<your_back_end_port>"

image

  • Copy the https url generate by ngrok as an URL to api call for your app. Ex: https://1af4-123-22-24-194.ngrok.io/authentication
  • Iam using Flipper to debugging by the way, recommend you using this tool , it's very awsome
  • My BE is ASP.NET incase you need more infomation

@donni106
Copy link

donni106 commented Mar 23, 2022

https://www.digicert.com/help/ - U can check ssl configuration is done prorperly or not using this link

@gvsakhil thanks, that page helped me to identify some problems, which i hope are the reasons for the fetch not working in our application.

Bildschirmfoto 2022-03-23 um 17 31 50

no i am figuring out with some colleagues, how to solve the insecure ones. any helpful suggestions?

@donni106
Copy link

i figured out my problem. at the end it was no problem with server and SSL.
i requested data with FormData and 'Content-Type': 'application/json' instead of 'Content-Type': 'multipart/form-data'. would be nice if android would had given some other hints on this beside "Network request failed", as iOS worked well.

@Aiosa
Copy link

Aiosa commented Aug 13, 2022

https://www.digicert.com/help/

Let's encrypt users

Yes, please use this. Even better is https://www.ssllabs.com/ to inspect multiple android devices support at once. Older versions of android might not find a trusted authority in your certificate, especially if you use Let's encrypt. Internet Security Research Group is not enough. Older devices use only TLS 1.2 not 1.3 and the certificate might not be verified.

@king-faraz
Copy link

instead of trying local host use your android amulator ip address
10.0.0.8

https://10.0.0.8:8081/getcall

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label May 25, 2023
@github-actions
Copy link

github-actions bot commented Jun 1, 2023

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed Jun 1, 2023
@JamesPJ
Copy link

JamesPJ commented Jul 8, 2023

I still can't get the API calls working on Android 9. On all other versions of Android works well. And I use cloudflare SSL certificate on my domain. So, not sure what is going on with Android 9. Any help would be appreciated.

@leopard1982
Copy link

Hi All,
I found a work around solution for Http (non HTTPS) fetch :
Add the codes in your main AndroidManifest.xml
<manifest xmlns:tools="http://schemas.android.com/tools"> .... <application android:usesCleartextTraffic="true" tools:targetApi="28"> ... </application> </manifest>

That worked for me too. Thanks! @mohsenomidi

I was having the same problem OP had, but using axios and having just updated my cordova android platform to the newest one.

Hai Broooo you save my day!

@GeorgeFlorian
Copy link

This worked for me on EXPO SDK 49:
I've installed expo-build-properties using npx expo install expo-build-properties and then added it as a plugin in app.json:

    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "usesCleartextTraffic": true
          }
        }
      ]
    ]

@PhuNguyen8902
Copy link

Hi All,
I found a work around solution for Http (non HTTPS) fetch :
Add the codes in your main AndroidManifest.xml
<manifest xmlns:tools="http://schemas.android.com/tools"> .... <application android:usesCleartextTraffic="true" tools:targetApi="28"> ... </application> </manifest>

That worked for me too. Thanks! @mohsenomidi
I was having the same problem OP had, but using axios and having just updated my cordova android platform to the newest one.

Hai Broooo you save my day!
Me too thanks you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🌐Networking Related to a networking API. Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests