cant run debug version of app on physical device
Closed this issue · 7 comments
Please add more details. I have no idea how to reproduce this.
I fully tested the plugin on real device while I was developing it.
I create a new project from scratch via npx react-native init AwesomeProject
and after that installed tapsell.
and these are my dependencies: {
"react": "17.0.1",
"react-native": "0.64.2",
"react-native-tapsell-plus": "^2.1.3"
}
finally ran npm run android
everything works fine on the emulator and even the release version works fine on a real device but I couldn't run my debug app on a real device and got error
Thanks, I'll try that.
In the mean time please add the error logs of the npm run android
command
`> Task :app:installDebug
Installing APK 'app-debug.apk' on 'SM-A307FN - 11' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 40s
46 actionable tasks: 2 executed, 44 up-to-date
info Connecting to the development server...
info Starting the app on "RZ8N110RQCL"...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }`
but on the phone instead of normal render, I see the error which I send you the screenshot of it
Note that the attached screen shot does not describe the reason. You need to check either the metro server logs or the log result of npm run android
I suggest checking out metro server logs and sending the related part here.
Surprisingly I could solve it by adding network security config to androidManifest file
android:networkSecurityConfig="@xml/network_security_config"
--> androidManifest.xml
heres a content which I import it in manifest file.
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">localhost</domain> </domain-config> </network-security-config>
Is it possible to resolve this issue without adding this xml file?
Wouldn't this make security issues in the app?
@AlirezaHadjar this is not a tapsell-plus related issue.
In debug version react native uses localhost
to bridge it's js code to the device realtime.
I now remember that I had this issue when running the app on debug version.
Is it possible to resolve this issue without adding this xml file?
I don't know. I only know that this is ONLY needed on debug. Because localhost
isn't a https
endpoint
A solution is to use a device with Android version 8 or lower. This is related to android 9 http blocking feature.
Wouldn't this make security issues in the app?
Since only domain registered to be allowed with http
request is localhost
, then NO.
Reference: React native docs