schwabe / ics-openvpn

OpenVPN for Android
3.36k stars 1.2k forks source link

Problems acessing AIDL with minifyEnabled #1755

Closed JHarzenetter closed 2 months ago

JHarzenetter commented 2 months ago

To make issues more manageable, I would appreciate it if you fill out the following details as applicable:

General information

  1. Android Version: 14
  2. Android Vendor/Custom ROM: Samsung
  3. Device: Galaxy A23 5G
  4. Version of the app (version number/play store version/self-built): Current PlayStore-Version

Description of the issue

I get some problems after i added the aidl API and trying to relase it with minification enabled. Additional i tried this example app and narrowed it down to the following problem

  1. Edit build.gradle from exampleApp and add the following
    buildTypes{
        release {
            minifyEnabled true
            signingConfig signingConfigs.debug
        }
    }
  2. Make sure it's an fresh installation.
  3. Open the App

Whats missing after App start:

I'm pretty sure that it's the minifyEnabled-Flag thats causing it. Maybe you can help me out. And no disableing the minification is not an option because it causes the app to be 5x the size

schwabe commented 2 months ago

Yes, minify changes class names. You need to add a configuration to avoid this. Or just disable renaming of classes if possible. But I am not using minify myself, so I cannot give you any further help at the moment. But a PR that adds a minify configuration is weclome.

JHarzenetter commented 2 months ago

@schwabe I tried it myself and got it working in a very simple way. Just add the following in the proguard-rules.pro file in the Project which is using the AIDL.

-keep interface de.blinkt.openvpn.api.IOpenVPNAPIService { *; }
-keep interface de.blinkt.openvpn.api.IOpenVPNStatusCallback { *; }
-keep class de.blinkt.openvpn.api.APIVpnProfile { *; }
schwabe commented 2 months ago

Thanks I added these rules to the example project.