React Native/React Native_etc
[React Native] release 버전에서 axios 사용 시 에러 발생 해결
bocoder
2021. 9. 15. 10:30
728x90
반응형
개발을 완료 후 debug mode 로 테스트 시 잘 되던 api 호출이, release 모드로 빌드하니 되지 않음
# run debug mode
react-native run-android
# run release mode & build .apk file
react-native run-android --variant=release
api 호출을 위해 axios 를 사용했는데, AndroidManifest.xml 파일에 android:usesCleartextTraffic="true" 설정을 추가해서 해결
# android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="kr.co.bocoder.findanimal">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
...
android:usesCleartextTraffic="true" // ----->>> add this
>
<activity
android:name=".MainActivity"
...
>
<intent-filter>
...
</intent-filter>
</activity>
</application>
</manifest>
* refered : https://github.com/facebook/react-native/issues/24039#issuecomment-518687649
* android/app/src/debug/AndroidManifest.xml 에는 별도 설정 없이도 자동 추가되어 있었음
728x90
반응형