react-native-webrtc: App crashes after updating react-native-webrtc ^1.100.1 to 111.0.0 on "react-native": "0.64.4"

Please help, I was using react-native-webrtc ^1.100.1 , it was working fine after updating to latest version, install the app it installed successfully but when running it crashes instantly on android .

following are my dependencies

{
  "dependencies": {
    "react": "17.0.1",
    "react-native": "0.64.4"
  }
}

minSdkVersion = 24

already added the following to my proguard-rules.pro file.

-keep class org.webrtc.** { *; }

here is android logs on flipper console

FATAL EXCEPTION: main
Process: com.wepoc, PID: 14406
java.lang.RuntimeException: Unable to instantiate application com.wepoc.MainApplication: java.lang.ClassNotFoundException: Didn't find class "com.wepoc.MainApplication" on path: DexPathList[[zip file "/data/app/com.wepoc-1/base.apk"],nativeLibraryDirectories=[/data/app/com.wepoc-1/lib/x86, /data/app/com.wepoc-1/base.apk!/lib/x86, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]]
	at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5392)
	at android.app.ActivityThread.-wrap2(ActivityThread.java)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1548)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6138)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.wepoc.MainApplication" on path: DexPathList[[zip file "/data/app/com.wepoc-1/base.apk"],nativeLibraryDirectories=[/data/app/com.wepoc-1/lib/x86, /data/app/com.wepoc-1/base.apk!/lib/x86, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]]
	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
	at android.app.Instrumentation.newApplication(Instrumentation.java:1021)
	at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
	... 9 more

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

I can indeed reproduce the crash when running a clean app with RN 0.64.4, this module and the settings provided. If i use Java 8 - JDK 1.8.0 then there are some weird compile errors. Moving over to Java 11 seems to achieve a compile but then launch errors. Best bet is probably upgrading RN as the issue doesn’t exist on latest. That being said i will have a bash to see if i can resolve the crash.

Alrighty, I’ve managed to resolve the launch crash by making these changes.

Inside android/build.gradle change the following versions.

buildToolsVersion = "30.0.2"
classpath("com.android.tools.build:gradle:4.2.2")

Also inside android/gradle/wrapper/gradle-wrapper.properties upgrade the gradle distro a little.

distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip

Last but not least you will need to add the android:exported="true" property to your MainActivity inside android/app/src/main/AndroidManifest.xml which resolves the Android 12 targeting error.

@AliSaeed090 Can you please test to see if that resolves the issue for you. If it doesn’t then the alternative is to upgrade RN.

We don’t do anything specific not to support it, but RN 0.64 has been EOL for a long time. We can’t really spend resources fixing bugs in unmaintained RN versions.