Flutter webrtc build android release error

lib: flutter_webrtc

example:

https://github.com/nhancv/nc-flutter-webrtc-ex

Error

#
# Fatal error in: ../../../../usr/local/google/home/sakal/code/webrtc-aar-release/src/sdk/android/src/jni/jni_generator_helper.cc, line 28
# last system error: 88
# Check failed: !clazz.is_null()
# org/webrtc/WebRtcClassLoader

Fix

  • Add file android/app/proguard-rules.pro
## Flutter WebRTC
-keep class com.cloudwebrtc.webrtc.** { *; }
-keep class org.webrtc.** { *; }
  • Update android/app/build.gradle
buildTypes {
    debug {
        debuggable true
        signingConfig signingConfigs.debug
    }
    release {
        debuggable false
        minifyEnabled true
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
}

https://medium.com/@nhancv

https://www.upwork.com/fl/nhancv

The Best/Expert Flutter Freelancers For Hire In Vietnam — Upwork™

Leave a Reply

Your email address will not be published.Required fields are marked *