Reputation: 284
I have the following error when I try to run my React Native app in Android Studio.
When running the application, it tries to start, but fails and displays the following error.
07/26 15:05:47: Launching 'app' on Pixel 3 API R.
$ adb shell am start -n "com.recetasdemiyaya/com.recetasdemiyaya.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 6259 on device 'Pixel_3_API_R [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/recetasdemiyay: Not late-enabling -Xcheck:jni (already on)
I/recetasdemiyay: Unquickening 13 vdex files!
W/recetasdemiyay: Unexpected CPU variant for X86 using defaults: x86
I/recetasdemiyay: The ClassLoaderContext is a special shared library.
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
No Network Security Config specified, using platform default
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.recetasdemiyaya, PID: 6259
java.lang.RuntimeException: Unable to instantiate application com.recetasdemiyaya.MainApplication: java.lang.ClassNotFoundException: Didn't find class "com.recetasdemiyaya.MainApplication" on path: DexPathList[[zip file "/data/app/~~CE-MOv3Jm55BXMcdUPlUeg==/com.recetasdemiyaya-889WixNrp2DNabkeMOGRLA==/base.apk"],nativeLibraryDirectories=[/data/app/~~CE-MOv3Jm55BXMcdUPlUeg==/com.recetasdemiyaya-889WixNrp2DNabkeMOGRLA==/lib/x86, /data/app/~~CE-MOv3Jm55BXMcdUPlUeg==/com.recetasdemiyaya-889WixNrp2DNabkeMOGRLA==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1211)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6521)
at android.app.ActivityThread.access$1300(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1885)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7464)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.recetasdemiyaya.MainApplication" on path: DexPathList[[zip file "/data/app/~~CE-MOv3Jm55BXMcdUPlUeg==/com.recetasdemiyaya-889WixNrp2DNabkeMOGRLA==/base.apk"],nativeLibraryDirectories=[/data/app/~~CE-MOv3Jm55BXMcdUPlUeg==/com.recetasdemiyaya-889WixNrp2DNabkeMOGRLA==/lib/x86, /data/app/~~CE-MOv3Jm55BXMcdUPlUeg==/com.recetasdemiyaya-889WixNrp2DNabkeMOGRLA==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:202)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:49)
at android.app.Instrumentation.newApplication(Instrumentation.java:1158)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1203)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6521)
at android.app.ActivityThread.access$1300(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1885)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7464)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
In the EVENT LOG section, it shows me the following error:
Unsupported Modules Detected: Compilation is not supported for following modules: lottie-react-native, react-native-admob, android-react-native-fbsdk, android-react-native-onesignal, android-react-native-fast-image, android-react-native-blur, android-react-native-webview, android-react-native-vector-icons, android-react-native-gesture-handler, android-react-native-linear-gradient, android-react-native-admob, android-lottie-react-native, react-native-blur, react-native-fbsdk, react-native-onesignal, react-native-gesture-handler, react-native-vector-icons, react-native-linear-gradient, react-native-fast-image, react-native-webview. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project
.
When I try to run the application in the terminal from the root of my project, with the react-native run-android
command, the application shows for an instant, but it doesn't start working, but it doesn't show me errors.
However, when I run the react-native run-ios
command the application works perfectly in my simulator.
My experience is little and my command of English is also little, so I do not know where to go and where to look within my project to correct the errors that Android Studio shows me.
I have updated Android Studio, as I have read similar problems before coming to ask, but I don't know how to eliminate LA CACHES / RESTART => INVALIDATE CACHES & RESTART, which I have seen in another question
What should I do for Invalidate Caches?
I'm still looking for a solution, but I can't find a way, I keep looking at other questions, but I think I'm not looking correctly, and that's why I'm here.
Can you help me ?
Thank you
Upvotes: 0
Views: 2397
Reputation: 11
Cleaning gradlew works for me
cd android && ./gradlew clean && cd ..
Upvotes: 0
Reputation: 494
1- close the project
2- close Android Studio IDE
3- delete the .idea directory
4- delete all .iml files
5- open Android Studio IDE and import the project
if issue still exist copy project to other location and open it again in Android studio.
Upvotes: 1