DEV Community

Fadi Al-Atia
Fadi Al-Atia

Posted on

Error Analysis

To learn how to analyze an error, we are going to use the error below as an example:

nx run mobile:android

     7/7 dependent project tasks succeeded [6 read from cache]

   Hint: you can run the command with --verbose to see the full dependent project outputs

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run mobile:android

> npx expo run:android

 Opening emulator Medium_Phone
 Building app...
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration on demand is an incubating feature.

> Configure project :
[ExpoRootProject] Using the following versions:
  - buildTools:  36.0.0
  - minSdk:      24
  - compileSdk:  36
  - targetSdk:   36
  - ndk:         27.1.12297006
  - kotlin:      2.1.20
  - ksp:         2.1.20-2.0.1

> Configure project :app
 ℹ️  Applying gradle plugin 'expo-max-sdk-override-plugin'
  [expo-max-sdk-override-plugin] This plugin will find all permissions declared with `android:maxSdkVersion`. If there exists a declaration with the `android:maxSdkVer
sion` annotation and another one without, the plugin will remove the annotation from the final merged manifest. In order to see a log with the changes run a clean build of the app.                                                                                                                                                           ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin'

> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 34.10.0dencies of :app:debugRuntimeClasspath > :react-native-firebas
:react-native-firebase_app:play.play-services-auth using default value: 21.5.0
:react-native-firebase_app package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 23.8.8 (23,8,8 - 23008008)
:react-native-firebase_app:android.compileSdk using custom value: 36
:react-native-firebase_app:android.targetSdk using custom value: 36
:react-native-firebase_app:android.minSdk using custom value: 24
:react-native-firebase_app:reactNativeAndroidDir /home/user/projects/my-app/node_modules/react-native

> Configure project :react-native-firebase_auth
:react-native-firebase_auth package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/auth/package.json
:react-native-firebase_app package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_auth:firebase.bom using default value: 34.10.0
:react-native-firebase_auth package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/auth/package.json
:react-native-firebase_auth:version set from package.json: 23.8.8 (23,8,8 - 23008008)
:react-native-firebase_auth:android.compileSdk using custom value: 36
:react-native-firebase_auth:android.targetSdk using custom value: 36
:react-native-firebase_auth:android.minSdk using custom value: 24
:react-native-firebase_auth:reactNativeAndroidDir /home/user/projects/my-app/node_modules/react-native

> Configure project :react-native-firebase_crashlytics
:react-native-firebase_crashlytics package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/crashlytics/package.json
:react-native-firebase_app package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_crashlytics:firebase.bom using default value: 34.10.0
:react-native-firebase_crashlytics package.json found at /home/user/projects/my-app/node_modules/@react-native-firebase/crashlytics/package.json
:react-native-firebase_crashlytics:version set from package.json: 23.8.8 (23,8,8 - 23008008)
:react-native-firebase_crashlytics:android.compileSdk using custom value: 36
:react-native-firebase_crashlytics:android.targetSdk using custom value: 36
:react-native-firebase_crashlytics:android.minSdk using custom value: 24
:react-native-firebase_crashlytics:reactNativeAndroidDir /home/user/projects/my-app/node_modules/react-native

> Configure project :expo-modules-core
Linking react-native-worklets native libs into expo-modules-core build tasks
task ':react-native-worklets:mergeDebugNativeLibs'
task ':react-native-worklets:mergeReleaseNativeLibs'

> Configure project :expo

Using expo modules
  - expo-log-box (55.0.7)
  - expo-constants (55.0.9)
  - expo-dev-client (55.0.18)
  - expo-dev-launcher (55.0.19)
  - expo-dev-menu (55.0.16)
  - expo-dev-menu-interface (55.0.1)
  - expo-json-utils (55.0.0)
  - expo-manifests (55.0.11)
  - expo-modules-core (55.0.17)
  - expo-updates-interface (55.1.3)
  - [📦] expo-dom-webview (55.0.3)
  - [📦] expo-application (55.0.10)
  - [📦] expo-asset (55.0.10)
  - [📦] expo-device (55.0.10)
  - [📦] expo-document-picker (55.0.9)
  - [📦] expo-file-system (55.0.11)
  - [📦] expo-font (55.0.4)
  - [📦] expo-haptics (55.0.9)
  - [📦] expo-image (55.0.6)
  - [📦] expo-intent-launcher (55.0.9)
  - [📦] expo-keep-awake (55.0.4)
  - [📦] expo-linking (55.0.8)
  - [📦] expo-localization (55.0.9)
  - [📦] expo-network (55.0.9)
  - [📦] expo-notifications (55.0.13)
  - [📦] expo-router (55.0.7)
  - [📦] expo-sharing (55.0.14)
  - [📦] expo-splash-screen (55.0.12)
  - [📦] expo-system-ui (55.0.10)
  - [📦] expo-web-browser (55.0.10)

> Task :app:compileDebugKotlin FAILED
e: file:///home/user/projects/my-app/apps/mobile/android/app/src/main/java/com/example/myapp/MainApplication.kt:18:21 Unresolved reference 'ReactNativeHostWrapper'.
e: file:///home/user/projects/my-app/apps/mobile/android/app/src/main/java/com/example/myapp/MainApplication.kt:22:51 Unresolved reference 'ReactNativeHostWrapper'.
e: file:///home/user/projects/my-app/apps/mobile/android/app/src/main/java/com/example/myapp/MainApplication.kt:40:13 Unresolved reference 'ReactNativeHostWrapper'.

[Incubating] Problems report is available at: file:///home/user/projects/my-app/apps/mobile/android/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details
> IDLE
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.14.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 40s
650 actionable tasks: 32 executed, 618 up-to-date
Error: /home/user/projects/my-app/apps/mobile/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=
8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1                                                                                          Error: /home/user/projects/my-app/apps/mobile/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=
8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1                                                                                              at ChildProcess.completionListener (/home/user/projects/my-app/node_modules/@expo/spawn-async/src/spawnAsync.ts:67:13)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1101:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
    ...
    at spawnAsync (/home/user/projects/my-app/node_modules/@expo/spawn-async/src/spawnAsync.ts:28:21)
    at spawnGradleAsync (/home/user/projects/my-app/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:134:28)
    at assembleAsync (/home/user/projects/my-app/node_modules/@expo/cli/src/start/platforms/android/gradle.ts:83:16)
    at runAndroidAsync (/home/user/projects/my-app/node_modules/@expo/cli/src/run/android/runAndroidAsync.ts:62:24)

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Ran target android for project mobile and 7 task(s) they depend on (1m)

     1/8 failed
     7/8 succeeded [6 read from cache]

Enter fullscreen mode Exit fullscreen mode

Step #1: Ignore the Noise

  • Basically, the error logs are quite long, so dont let the longness of an error distract you or make you think the error is unsolvable.
  • Immediately start scanning for keywords like: Error, Failed, Exception.
  • So in our example, we can see a keyword"
> Task :app:compileDebugKotlin FAILED
e: file:///home/user/projects/my-app/apps/mobile/android/app/src/main/java/com/example/myapp/MainApplication.kt:18:21 Unresolved reference 'ReactNativeHostWrapper'.
e: file:///home/user/projects/my-app/apps/mobile/android/app/src/main/java/com/example/myapp/MainApplication.kt:22:51 Unresolved reference 'ReactNativeHostWrapper'.
e: file:///home/user/projects/my-app/apps/mobile/android/app/src/main/java/com/example/myapp/MainApplication.kt:40:13 Unresolved reference 'ReactNativeHostWrapper'.
Enter fullscreen mode Exit fullscreen mode

Step #2: Understand what error is saying

  • You have to read the error to determine which file is causing the issue, and also understand what is the error exactly.
  • In our example, we can see that MainApplication.kt is having an issue in lines 18, 22, and 40, and the error is saying that ReactNativeHostWrapper is unresolved.

Step #3: Build Hypotheses

  • Now try to build a "why" question about what happened and give multiple answers.
  • In our example, we can do that by saying:
    • Why is our ReactNativeHostWrapper unresolved?
      • Could be a missed import
      • Maybe the class is no longer available (Deleted)
      • The dependency is not available.

Step #4: Investigate

  • Now you have the error known, potential reasons in hand, you start solving them one by one and scratching the case that didn't solve the issue.
  • You can ask more questions to yourself that will help with each case (Questions may vary based on the error you face), such as:
    • What am I importing in that file?
    • Where does this class even come from?
    • Where is it used?
    • Did I update Expo or React Native? (In case the error was build related)
    • Does this class exist in the current version of Expo?

Step #5: Search Strategically

  • Use Google or other AI agents to your advantage if you reached a dead end.
  • Time is money, so always be strategic and precise for what you are looking for, so dont just look for the error name, you can also provide extra details such as the framework and its version so you get better results faster.

TL;DR: The Mental Checklist

  • Find the real error
  • Read it literally
  • Form hypothesis and "Why" questions
  • Answer them and ask more precise questions based on cases from previous step
  • Search with context.

Top comments (0)