Hi,
I'm using RN 0.30 on Windows 10, Android Studio and I add to my project gradle this:
compile 'com.squareup.okhttp3:okhttp:3.4.1'
Then if run project return error (application won't run):
"Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created"
Now I use old version
compile 'com.squareup.okhttp3:okhttp:3.3.1'
and all work fine.
This seems like a problem with okhttp rather than a problem with React Native, unless you can isolate the problem more specifically to React Native.
@lacker I have test downgrading okhttp from v3.4.1 to v3.3.1 but don`t change this exception. This issue can be easy repeated if you enable Proguard in debug build (the reason is that 64K methods limit is reached for my Android app).
"react-native": "^0.42.3"
MainApplication.java
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
// https://github.com/airbnb/native-navigation
ReactNavigationCoordinator coordinator = ReactNavigationCoordinator.sharedInstance;
/* line 79*/ coordinator.injectReactInstanceManager(mReactNativeHost.getReactInstanceManager());
coordinator.start(this);
}
Stacktrace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test1:acra, PID: 5117
java.lang.RuntimeException: Unable to create application com.test1.MainApplication: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5364)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:77)
at com.facebook.react.ReactInstanceManager.<init>(ReactInstanceManager.java:326)
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:227)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:84)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
at com.test1.MainApplication.onCreate(MainApplication.java:79)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)
at android.app.ActivityThread.-wrap2(ActivityThread.java)聽
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)聽
at android.os.Handler.dispatchMessage(Handler.java:102)聽
at android.os.Looper.loop(Looper.java:154)聽
at android.app.ActivityThread.main(ActivityThread.java:6077)聽
at java.lang.reflect.Method.invoke(Native Method)聽
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)聽
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)聽
Caused by: java.lang.ClassNotFoundException: com.facebook.react.devsupport.DevSupportManagerImpl
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:62)
at com.facebook.react.ReactInstanceManager.<init>(ReactInstanceManager.java:326)聽
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:227)聽
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:84)聽
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)聽
at com.test1.MainApplication.onCreate(MainApplication.java:79)聽
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)聽
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)聽
at android.app.ActivityThread.-wrap2(ActivityThread.java)聽
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)聽
at android.os.Handler.dispatchMessage(Handler.java:102)聽
at android.os.Looper.loop(Looper.java:154)聽
at android.app.ActivityThread.main(ActivityThread.java:6077)聽
at java.lang.reflect.Method.invoke(Native Method)聽
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)聽
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)聽
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl" on path: DexPathList[[zip file "/data/app/com.test1-1/base.apk"],nativeLibraryDirectories=[/data/app/com.test1-1/lib/x86, /data/app/com.test1-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
Can we check if(__DEV__) and add this Proguard rule automatically? (in react-native .aar module project)
This is my fix for this issue:
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "devsupport.pro"
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.config
}
}
devsupport.pro
-keep class com.facebook.react.devsupport.** { *; }
-dontwarn com.facebook.react.devsupport.**
Having the same issue using RN 0.44.2
Any workaround @sytolk ? Your fix proposal didn't worked for me.
same on RN 0.42.3
This is happening to me as well something about "Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created". It happens when I build the react native instance manager
I'm having the same issue on RN 48. It has no problems on android 7+ but in 4.4.4 it crashes. why is this issue closed ?
@mehdijjz try to update Gradle.
Updating Gradlle like @iegik suggest, didn't solves this issue (at least for me).
@andfk, try this: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta4'
}
}
Got the same issue described by @mehdijjz
many thanks @iegik
sadly @iegik `s fix is not working for me
same issue for me.. only happens on Android 4 version
Same issue for me well. The usecase is as mentioned by @sytolk
Happens when I enable Proguard in Debug build.
Is there a workaround for it? Can the issue be reopened please?
Same issue here on 0.48.4
I did not manage to achieve Gradle migration to 3.x
So I tried to enable MultiDexApplication as advised by this link and it worked for me :)
I solved it by adding
compile 'com.android.support:multidex:1.0.0'to app/build.gradle and changingextends Applicationtoextends MultiDexApplicationin NavigationApplication.java
This solution worked for me. I don't know why it doesn't manifest itself in the Debug mode.
Thanks for your help ou2s.
@sytolk It worked锛乀hanks for help.
The link posted by @ou2s also worked in my case. My app has multidex and proguard enabled, but the app only crashed on one phone in our office (Galaxy Note running 4.4.1). Other devices ran without adding to dependencies and changing extends Application to extends MultiDexApplication.
Most helpful comment
Can we check if(__DEV__) and add this Proguard rule automatically? (in react-native .aar module project)
This is my fix for this issue:
devsupport.pro