ccnnde/react-native-simple-openvpn

App crashes on expo with bare workflow

hkhawar21 opened this issue · 10 comments

Bug description:
When building the app with expo cli and bare workflow, the connection fails with app crashing. Tried linking the file and using contents of file in ovpnString but the result is still the same.

To Reproduce:
"react-native": "0.68.2",
"expo": "~45.0.0",
"react-native-simple-openvpn": "^2.0.0"
Setup a react native with Expo CLI and then expo eject in it to switch over to bare workflow. Add the connection on pressing of a button

Expected behavior:
The connection should set up with the notification displayed.

Environment:

  • OS: Android
  • OS version: 10
  • react-native version: 0.68.2
  • react-native-simple-openvpn version: ^2.0.0

can you share the code and package.json

Code for setting up the connection

async function handleConnection() {
try {
await RNSimpleOpenvpn.connect({
ovpnString: ovpnString,
providerBundleIdentifier: "com.example.RNSimpleOvpnTest.NEOpenVPN",
});
} catch (error) {
console.error(error);
}
setStatusVPN(!statusVPN);
}

package.json
{
"name": "vpn-app",
"version": "1.0.0",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@expo-google-fonts/poppins": "^0.2.2",
"@gorhom/bottom-sheet": "^4.4.3",
"@react-navigation/native": "^6.0.10",
"@react-navigation/native-stack": "^6.6.2",
"axios": "^0.27.2",
"expo": "~45.0.0",
"expo-app-loading": "~2.0.0",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"expo-updates": "~0.13.4",
"global": "^4.4.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-cli": "^2.0.1",
"react-native-feather": "^1.1.2",
"react-native-gesture-handler": "~2.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-simple-openvpn": "^2.0.0",
"react-native-status-bar-height": "^2.6.0",
"react-native-svg": "12.3.0",
"react-native-web": "0.17.7"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@types/react": "^17.0.41",
"@types/react-native": "~0.66.13",
"typescript": "~4.3.5"
},
"private": true,
"resolutions": {
"@types/react": "17.0.45"
}
}

Try remove the providerBundleIdentifier

The issue still persists and the app is crashing

Can you share the debug logs

I previously also had a crash due to the addition of the list of allowed applications but I fixed it with some changes to the java code, you can see in the pull request.

It did not fixed the issue for me and I tried generating the debug logs but it would not happen on an apk which is my only available source right now

here is the result which I could find

[16817,0,com.hkhawar19.vpnapp,948485700,java.lang.UnsatisfiedLinkError,dlopen failed: library "libovpnutil.so" not found,Runtime.java,1087]

Im having the same issue, same not found error. Have you find a solution for it?

simply following this recommendations resolve this issue

Import jniLibs