schwabe / ics-openvpn

OpenVPN for Android
3.31k stars 1.19k forks source link

Support for `ARMv8` #1357

Closed KaustubhPatange closed 2 years ago

KaustubhPatange commented 3 years ago

I've been developing a VPN app based on OpenVPN using this library called Gear VPN. Thanks for this awesome & simple to use the library (kudos to sample).

Recently, I've been seeing crashes from my app on Firebase Analytics regarding some devices which have stack trace as follow

Fatal Exception: java.lang.RuntimeException: Cannot find any execulte for this device's ABIs [arm64-v8a, armeabi-v7a, armeabi]
       at de.blinkt.openvpn.core.VPNLaunchHelper.writeMiniVPN(VPNLaunchHelper.java:54)
       at de.blinkt.openvpn.core.VPNLaunchHelper.buildOpenvpnArgv(VPNLaunchHelper.java:79)
       at de.blinkt.openvpn.core.OpenVPNService.startOpenVPN(OpenVPNService.java:647)
       at de.blinkt.openvpn.core.OpenVPNService.access$200(OpenVPNService.java:74)
       at de.blinkt.openvpn.core.OpenVPNService$2.run(OpenVPNService.java:610)
       at java.lang.Thread.run(Thread.java:784)

It looks like the library does not support some ABIs. Following are some devices whose crashes I've been seeing so far for this issue,

  1. HUAWEI Honor 7A (armv8), Android Version 8.0.0
  2. TECNO WX3P (armv7), Android Version 7.0
  3. Samsung Galaxy J2 Core (armv8a), Android Version 8.1
  4. Samsung Galaxy J7 (armv8a), Android Version 5.1.1
  5. Vivo V1818A (armv8), Android Version 8.1

From my understanding, it mostly occurs with armv8 & armv8a, and supported is arm64-v8a can we build the library targeting this ABI?

schwabe commented 3 years ago

You need to change your license to GPL2/3 since you are basing your app on mine, which is GPL licensed.

My app should work fine on 64 bit Android and actually has done so for many years. Please check if the same crash also occurs with my app or just your fork.

KaustubhPatange commented 3 years ago

It seems like the problem is with 32-bit devices. I can't test it since I don't own these devices & these crashes are from Firebase Crashlytics!

Can we target build to generate libraries for 32-bit architecture?

schwabe commented 3 years ago

I think you probably have a different problem. On older Android version the app is started differently than on newer ones (binary from assets) and you are missing those assets. Check yourself if an older device/emulator.

KaustubhPatange commented 3 years ago

I am seeing some files like pie_openvpn-** & nopie_openvpn-**, are you talking about this. Also, I've tested on each API level on emulator from 21 to 30 & it works completely fine. It's just these crashes with the above-mentioned devices!

schwabe commented 3 years ago

@KaustubhPatange without reproducing itself I also don't have a problem but the code that produces that message is triggered if it cannot find those binary assets.

And this problem is not something I have encountered with my own app, so I really don't know what is happening on your end but check the writeMiniVPN method.

KaustubhPatange commented 3 years ago

I updated the app with some additional logging in VPNLaunchHelper.java which should automatically log data to Firebase Crashlytics.

This additional logging might help to debug the issue! I'll reply to this issue when I got some more info on this.

schwabe commented 3 years ago

@KaustubhPatange yeah but that messaage basically says that it cannot find the assets. It might be something like bundle vs apk or different naming of the assets etc. I don't really know. But bundling these assets from the ndk buidld has always been sketchy and fragile in the build.

You could also try if the method that is used for P and up in that method works for older platforms too:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) in the writeMiniVPN

It should but I didn't want to change it since the old method had been proven and working for older versions.

KaustubhPatange commented 3 years ago

Yeah, I'm uploading aab on google play so it might be because of the abi split that gradle is doing when generating bundle & on the Google Play side it might be because of incorrect architecture selection.

You could also try if the method that is used for P and up in that method works for older platforms too:

I'll add a fallback to use the new method for devices lower than P. I'll keep you updated about this!

KaustubhPatange commented 2 years ago

Hey again, I'm not seeing regressions for this issue on my crash reporter site. For now I'll close this issue but re-open if this issue still persist.