简体   繁体   English

在Google Play商店上载APK后,React本机应用程序崩溃,这仅是第一次崩溃

[英]React native app crashes after uploading the apk on google play store, it crashes only for the first time

I am working on an app using react-native. 我正在使用react-native开发一个应用程序。 After generating Apk using ./gradlew assembleRelease everything works fine. 使用./gradlew assembleRelease生成Apk后,一切正常。 But when I upload the apk on google play store and installs, it crashes only for the first time. 但是,当我将apk上传到Google Play商店并进行安装时,它仅是第一次崩溃。 And gives the below error. 并给出以下错误。

Fatal Exception: java.lang.IllegalAccessError
Interface com.google.android.gms.internal.measurement.zzge implemented by class com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver is inaccessible (declaration of 'com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver' appears in base.apk)
java.lang.VMClassLoader.findLoadedClass (VMClassLoader.java)
java.lang.ClassLoader.findLoadedClass (ClassLoader.java:738)
java.lang.ClassLoader.loadClass (ClassLoader.java:363)
java.lang.ClassLoader.loadClass (ClassLoader.java:312)
android.app.AppComponentFactory.instantiateReceiver (AppComponentFactory.java:84)
android.app.ActivityThread.handleReceiver (ActivityThread.java:3482)
android.app.ActivityThread.access$1400 (ActivityThread.java:207)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1759)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:193)
android.app.ActivityThread.main (ActivityThread.java:6863)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:537)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)

I have tried changing proguard-rules.pro 我尝试过更改proguard-rules.pro

# firebase
-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keep class com.google.firebase.** { *; } 
-keep class io.invertase.firebase.** { *; }
-dontwarn io.invertase.firebase.**

I have also tried adding this code inside AndroidManifest.xml file 我也尝试过在AndroidManifest.xml文件中添加此代码

<receiver
         android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:permission="android.permission.INSTALL_PACKAGES"
android:enabled="true">
<intent-filter>
  <action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>

This issue is not coming with release apk being directed installed and checked but only happens when apk is uploaded on play store and downloaded for the first time. 定向安装和检查发行版apk时不会出现此问题,只有在将apk上载到Play商店并首次下载时才会发生。

I have been trying this for a couple of days now. 我已经尝试了几天了。 I would be glad if someone helps me with this issue. 如果有人可以帮助我解决这个问题,我将非常高兴。

I finally found the solution to this problem. 我终于找到了解决这个问题的方法。 This was not related proguard rules but due to the version mismatch of using firebase and google libraries. 这不是相关的proguard规则,但是由于使用Firebase和Google库的版本不匹配。 Check all the gms libraries version and firebase library version and use the versions which are mentioned to be used together. 检查所有gms库版本和firebase库版本,并使用提到的版本一起使用。 Checkout google libraries release version and support libraries version . 检出谷歌库发布版本支持库版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM