gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 00:53:38 28 4
gpt4 key购买 nike

我在我的应用程序中配置了 react-native-firebase 和 crashlytics。 iOS 构建成功。

但是当我运行 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/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.java: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( 4404): 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: 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, 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! 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! 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! 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

我的 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>

------------主应用------------

    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);
}
}

mainApp manifest

最佳答案

修改

<application
android:name=".MainApplication"

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

如果您修改了包名称,请将其替换为那个。

还要确保在 list 中导入正确的包

<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">

关于android - 添加 react-native-firebase crashlytics 后,Android 应用程序在第二个构建中崩溃,MainApplication 出现 classNotFound 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57069460/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com