简体   繁体   English

添加 react-native-firebase crashlytics 后,Android 应用程序在第二个构建中崩溃,MainApplication 出现 classNotFound 异常

[英]After add react-native-firebase crashlytics the Android App crashes in the second build with classNotFound Exception for MainApplication

I configured the react-native-firebase and crashlytics in my application.我在我的应用程序中配置了 react-native-firebase 和 crashlytics。 The iOS build is successfully worked. iOS 构建成功运行。

but when I run react-native run-android for the second time the app installed in the phone but it is crashed following is the adb logcat for application但是当我第二次运行react-native run-android时,手机中安装的应用程序崩溃了,下面是应用程序的adb logcat

I/ActivityManager( 611): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.company.mobile/.MainActivity (has extras)} from uid 10039 on display 0 W/AudioTrack( 611): AUDIO_OUTPUT_FLAG_FAST denied by client E/libprocessgroup( 4404): failed to make and chown /acct/uid_10059: Read-only file system W/Zygote ( 4404): createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT? I/ActivityManager(611): 从 uid 开始 u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.company.mobile/.MainActivity (has extras)} 10039 on display 0 W/AudioTrack(611): AUDIO_OUTPUT_FLAG_FAST 被客户端 E/libprocessgroup(4404) 拒绝: 无法制作和 chown /acct/uid_10059: 只读文件系统 W/Zygote (4404): createProcessGroup 失败,内核 CCONFIG CONFIG ? I/art ( 4404): Late-enabling -Xcheck:jni I/ActivityManager( 611): Start proc com.company.mobile for activity com.company.mobile/.MainActivity: pid=4404 uid=10059 gids={50059, 9997, 3003} abi=x86 D/AndroidRuntime( 4404): Shutting down VM E/AndroidRuntime( 4404): FATAL EXCEPTION: main E/AndroidRuntime( 4404): Process: com.company.mobile, PID: 4404 E/AndroidRuntime( 4404): java.lang.RuntimeException: Unable to instantiate application com.company.mobile.MainApplication: java.lang.ClassNotFoundException: Didn't find class "com.company.mobile.MainApplication" on path: DexPathList[[zip file "/data/app/com.company.mobile-2/base.apk"],nativeLibraryDirectories=[/data/app/com.company.mobile-2/lib/x86, /vendor/lib, /system/lib]] E/AndroidRuntime( 4404): at android.app.LoadedApk.makeApplication(LoadedApk.java:563) E/AndroidRuntime( 4404): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491) E/AndroidRuntime( 4404): at android.app.ActivityThread.access$1500(ActivityThread.ja I/art (4404): 延迟启用 -Xcheck:jni I/ActivityManager(611): 为活动 com.company.mobile/.MainActivity 启动 proc com.company.mobile: pid=4404 uid=10059 gids={50059, 9997, 3003} abi=x86 D/AndroidRuntime(4404): Shutting down VM E/AndroidRuntime(4404): FATAL EXCEPTION: main E/AndroidRuntime(4404): Process: com.company.mobile, PID: 4404 E/AndroidRuntime( 4404):java.lang.RuntimeException:无法实例化应用程序com.company.mobile.MainApplication:java.lang.ClassNotFoundException:在路径上找不到类“com.company.mobile.MainApplication”:DexPathList[[zip file” /data/app/com.company.mobile-2/base.apk"],nativeLibraryDirectories=[/data/app/com.company.mobile-2/lib/x86, /vendor/lib, /system/lib]] E/AndroidRuntime(4404): 在 android.app.LoadedApk.makeApplication(LoadedApk.java:563) E/AndroidRuntime(4404): 在 android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491) E/AndroidRuntime(4404) : 在 android.app.ActivityThread.access$1500(ActivityThread.ja va:144) E/AndroidRuntime( 4404): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339) E/AndroidRuntime( 4404): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 4404): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime( 4404): at android.app.ActivityThread.main(ActivityThread.java:5221) E/AndroidRuntime( 4404): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 4404): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime( 4404): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) E/AndroidRuntime( 4404): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) E/AndroidRuntime( 4404): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.company.mobile.MainApplication" on path: DexPathList[[zip file "/data/app/com.company.mobile-2/base.apk"],nativeLibraryDirectories=[/data/app/com.company.mobile-2/lib/x86, /vendor/lib, /system/lib]] E/AndroidRuntime( 4 va:144) E/AndroidRuntime(4404): 在 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339) E/AndroidRuntime(4404): 在 android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(4404): 在 android.os.Looper.loop(Looper.java:135) E/AndroidRuntime(4404): 在 android.app.ActivityThread.main(ActivityThread.java:5221) E/AndroidRuntime(4404) : 在 java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(4404): 在 java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime(4404): 在 com.android .internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) E/AndroidRuntime(4404): 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) E/AndroidRuntime(4404):引起:java.lang.ClassNotFoundException:在路径上找不到类“com.company.mobile.MainApplication”:DexPathList[[zip file“/data/app/com.company.mobile-2/base.apk”] ,nativeLibraryDirectories=[/data/app/com.company.mobile-2/lib/x86, /vendor/lib, /system/lib]] E/AndroidRuntime( 4 404): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) E/AndroidRuntime( 4404): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) E/AndroidRuntime( 4404): at java.lang.ClassLoader.loadClass(ClassLoader.java:469) E/AndroidRuntime( 4404): at android.app.Instrumentation.newApplication(Instrumentation.java:979) E/AndroidRuntime( 4404): at android.app.LoadedApk.makeApplication(LoadedApk.java:558) E/AndroidRuntime( 4404): ... 10 more E/AndroidRuntime( 4404): Suppressed: java.lang.ClassNotFoundException: com.company.mobile.MainApplication E/AndroidRuntime( 4404): at java.lang.Class.classForName(Native Method) E/AndroidRuntime( 4404): at java.lang.BootClassLoader.findClass(ClassLoader.java:781) E/AndroidRuntime( 4404): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) E/AndroidRuntime( 4404): at java.lang.ClassLoader.loadClass(ClassLoader.java:504) E/AndroidRuntime( 4404): ... 13 more E/AndroidRuntime( 4404): Caused by: java.lang.NoClassDefFoundError: 404): 在 dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) E/AndroidRuntime(4404): 在 java.lang.ClassLoader.loadClass(ClassLoader.java:511) E/AndroidRuntime(4404): 在 java. lang.ClassLoader.loadClass(ClassLoader.java:469) E/AndroidRuntime(4404):在 android.app.Instrumentation.newApplication(Instrumentation.java:979) E/AndroidRuntime(4404):在 android.app.LoadedApk.makeApplication( LoadedApk.java:558) E/AndroidRuntime(4404):...还有 10 个 E/AndroidRuntime(4404):被抑制:java.lang.ClassNotFoundException:com.company.mobile.MainApplication E/AndroidRuntime(4404):在 java。 lang.Class.classForName(Native Method) E/AndroidRuntime(4404): 在 java.lang.BootClassLoader.findClass(ClassLoader.java:781) E/AndroidRuntime(4404): 在 java.lang.BootClassLoader.loadClass(ClassLoader.java) :841) E/AndroidRuntime(4404): 在 java.lang.ClassLoader.loadClass(ClassLoader.java:504) E/AndroidRuntime(4404): ... 13 更多 E/AndroidRuntime(4404): 引起:java.lang .NoClassDefFoundError: Class not found using the boot class loader;使用引导类加载器找不到类; no stack available W/ActivityManager( 611): Force finishing activity com.company.mobile/.MainActivity I/WindowManager( 611): Screenshot max retries 4 of Token{1fd4adee ActivityRecord{3c07bf69 u0 com.company.mobile/.MainActivity t20 f}} appWin=Window{553e925 u0 Starting com.company.mobile} drawState=1 E/ActivityManager( 611): Invalid thumbnail dimensions: 768x768 W/art ( 611): Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12038 waiters=0 for 325ms I/OpenGLRenderer( 611): Initialized EGL, version 1.4 W/art ( 611): Long monitor contention event with owner method=int com.android.server.wm.WindowManagerService.relayoutWindow(com.android.server.wm.Session, android.view.IWindow, int, android.view.WindowManager$LayoutParams, int, int, int, int, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect,没有可用的堆栈 W/ActivityManager(611):强制完成活动 com.company.mobile/.MainActivity I/WindowManager(611):截图最大重试 4 次令牌{1fd4adee ActivityRecord{3c07bf69 u0 com.company.mobile/.MainActivity t20 f }} appWin=Window{553e925 u0 启动 com.company.mobile} drawState=1 E/ActivityManager(611):无效的缩略图尺寸:768x768 W/art (611):长监视器争用事件,所有者方法=void com.android。 server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) 来自 ActivityManagerService.java:12038 waiters=0 for 325ms I/OpenGLRenderer(611):初始化 EGL,版本 1.4 W /art(611):长监视器争用事件,所有者方法=int com.android.server.wm.WindowManagerService.relayoutWindow(com.android.server.wm.Session, android.view.IWindow, int, android.view.WindowManager $LayoutParams, int, int, int, int, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.content.res.Configuration, android.view.Surface) from WindowManagerService.java:2977 waiters=0 for 574ms I/Choreographer( 1497): Skipped 51 frames! android.graphics.Rect, android.graphics.Rect, android.content.res.Configuration, android.view.Surface) 来自 WindowManagerService.java:2977 waiters=0 for 574ms I/Choreographer(1497):跳过 51 帧! The application may be doing too much work on its main thread.应用程序可能在其主线程上做了太多工作。 W/EGL_emulation( 611): eglSurfaceAttrib not implemented W/OpenGLRenderer( 611): Failed to set EGL_SWAP_BEHAVIOR on surface 0xda5123c0, error=EGL_SUCCESS I/Choreographer( 611): Skipped 96 frames! W/EGL_emulation(611):eglSurfaceAttrib 未实现 W/OpenGLRenderer(611):未能在表面 0xda5123c0 上设置 EGL_SWAP_BEHAVIOR,错误=EGL_SUCCESS I/Choreographer(611):跳过 96 帧! The application may be doing too much work on its main thread.应用程序可能在其主线程上做了太多工作。 W/ActivityManager( 611): Activity pause timeout for ActivityRecord{3c07bf69 u0 com.company.mobile/.MainActivity t20 f} I/Choreographer( 611): Skipped 31 frames! W/ActivityManager(611):ActivityRecord 的活动暂停超时{3c07bf69 u0 com.company.mobile/.MainActivity t20 f} I/Choreographer(611):跳过 31 帧! The application may be doing too much work on its main thread.应用程序可能在其主线程上做了太多工作。 W/EGL_emulation( 1497): eglSurfaceAttrib not implemented W/OpenGLRenderer( 1497): Failed to set EGL_SWAP_BEHAVIOR on surface 0xdf214c40, error=EGL_SUCCESS W/EGL_emulation(1497):eglSurfaceAttrib 未实现 W/OpenGLRenderer(1497):无法在表面 0xdf214c40 上设置 EGL_SWAP_BEHAVIOR,错误 = EGL_SUCCESS

My AndroidManifest我的 AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.mobile"><uses-permission android:name="android.permission.INTERNET" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme">
  <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
    <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
  </service>
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

----------- main application ------------- ----------- 主要应用 -------------

    package com.company.mobile;

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import com.microsoft.appcenter.reactnative.crashes.AppCenterReactNativeCrashesPackage;
import com.microsoft.appcenter.reactnative.analytics.AppCenterReactNativeAnalyticsPackage;
import com.microsoft.appcenter.reactnative.appcenter.AppCenterReactNativePackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;

import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)),
          new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)),
          new AppCenterReactNativePackage(MainApplication.this),
          new RNGestureHandlerPackage(),
          new RNFirebasePackage(),
          new RNFirebaseMessagingPackage(),
          new RNFirebaseCrashlyticsPackage(),
          new RNCWebViewPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

主应用程序 显现

Modify调整

<application
android:name=".MainApplication"

to

<application
android:name="com.company.mobile.MainApplication"

If you've modified the package name then replace it with the one.如果您修改了包名称,请将其替换为该名称。

Also make sure that in manifest you're importing the correct package还要确保在清单中您导入了正确的包

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:dist="http://schemas.android.com/apk/distribution"
      xmlns:tools="http://schemas.android.com/tools"
      package="com.company.mobile">

暂无
暂无

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

相关问题 安装react-native-firebase后,React Native Android应用程序崩溃 - React Native Android app crashes after installing react-native-firebase react-native-firebase crashlytics 未显示在 Firebase 仪表板上 - react-native-firebase crashlytics not showing up on firebase dashboard Android发行版上的react-native-firebase NullPointerException - react-native-firebase NullPointerException on android release build react-native-firebase-收到推送通知后应用崩溃(Android) - react-native-firebase - App Crash after Push Notification Received (Android) 如何在调试模式下,在 react-native-firebase 中禁用 Crashlytics? - How to disable Crashlytics while in debug mode, in react-native-firebase? 使用 react-native-firebase 时添加对 Android 通知的回复 - Add replies to Android notifications while using react-native-firebase React-native-firebase 后台通知(Android) - React-native-firebase notification in background (Android) React Native - 添加 react-native-firebase 后 android 不会编译 - React Native - android wont compile after adding react-native-firebase 将 react-native-firebase/firestore 导入我的应用程序后,我收到构建错误“找不到 com.google.firebase:firebase-bom:21.3.0”。 - After importing react-native-firebase/firestore in to my app, I get the build error 'Could not find com.google.firebase:firebase-bom:21.3.0.' 添加 firebase crashlytics 时,Android 应用程序崩溃 - Android app crashes when adding firebase crashlytics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM