Wachu985 / flutter_wireguard_vpn

A Flutter package that allows connection through a VPN using WireGuard.
https://pub.dev/packages/wireguard_vpn
BSD 3-Clause "New" or "Revised" License
22 stars 9 forks source link

Release version not working (Android) #1

Closed aftabIDE closed 1 year ago

aftabIDE commented 1 year ago

First of all Thanks for such an wonderful work. There is an issue arise in release mode the app is not working but it is working in debug mode.

Possible cause: Wireguard packages might be removed due to pro-guard while creating release apk.

Looking for your response. Thank you.

vovacmig commented 1 year ago

If you open up the plugin code, you won't find anything about wireguard. The source code of the tunnel itself has not been added yet.

vovacmig commented 1 year ago

If the author is just starting to write a project, the working version should not be expected before six months.

ByteSizedMarius commented 1 year ago

Hello, in ./app/build.gradle in buildtypes release, try adding

shrinkResources false
minifyEnabled false

It seems to work for me. Your suggestion regarding pro-guard might be close :)

Update: I got it working by excluding the relevant classes from being minified by creating the file proguard-rules.pro in your project in android/app, and adding the following two lines:

-keep class app.wachu.wireguard_vpn.** {*;}
-keep class com.beust.klaxon.** {*;}

build.gradle does not need to be modified in that case. Tested with flutter v3.10.5, kt 1.7.10, gradle 7.5 (?)

Wachu985 commented 1 year ago

Hello, in ./app/build.gradle in buildtypes release, try adding

shrinkResources false
minifyEnabled false

It seems to work for me. Your suggestion regarding pro-guard might be close :)

Update: I got it working by excluding the relevant classes from being minified by creating the file proguard-rules.pro in your project in android/app, and adding the following two lines:

-keep class app.wachu.wireguard_vpn.** {*;}
-keep class com.beust.klaxon.** {*;}

build.gradle does not need to be modified in that case. Tested with flutter v3.10.5, kt 1.7.10, gradle 7.5 (?)

Thank you for the input. I've updated the README.md to include your solution and properly acknowledged your contribution. I believe I can close this issue now.

Wachu985 commented 1 year ago

Done

ByteSizedMarius commented 10 months ago

FYI, with Flutter 3.13.7 and Gradle 1.9.10, the proguard rules have stopped working. Disabling minify and shrink still works. I've tested around a bit, but didn't find a fix for the proguard-rules immediately. Soley based on the error message received by flutter, the issue seems to be that the parameters for SetStateParams are somehow lost, so it might be related to Klaxon. Since disabling minify and shrink solves the problem, there are not many options for what the problem could be.

@Wachu985