Skip to content

Native library conflict with libgojni.so when used alongside OpenVPN packages #118

@shafiquecbl

Description

@shafiquecbl

When using flutter_v2ray in a project that also includes OpenVPN packages (e.g., openvpn_flutter), the build fails with a native library merge conflict.

Error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libgojni.so' from inputs:
      - /Users/mshafique/.gradle/caches/transforms-4/ede96f7f4821d5cc7632f07ad28a12bf/transformed/jetified-openvpn_library-b3941ef040/jni/arm64-v8a/libgojni.so
      - /Users/mshafique/.gradle/caches/transforms-4/289c623916b04860255ea99e4a4407d2/transformed/jetified-libv2ray/jni/arm64-v8a/libgojni.so

Root Cause:
Both flutter_v2ray and openvpn_flutter packages bundle the same native library libgojni.so for multiple architectures (arm64-v8a, armeabi-v7a, x86, x86_64). This causes a merge conflict during the Android build process.

Current Workaround:
Using pickFirst in build.gradle to resolve the conflict causes V2Ray initialization to fail silently.

Expected Behavior:
flutter_v2ray should work without native library conflicts when used alongside other VPN protocol packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions