Skip to content

Android build doesn't launch due to missing reflective method classes #4958

Description

@ShivamJoker

Did you test using the latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test fail and you're not sure why?

  • I have read the troubleshooting guide and it didn't help me.

What happened?

Hi I am stuck on this issue for a month now, I would really appreciate some help.
I am able to get the test and release build done but when I run the test command the app fails to launch, but when I manually open the app it launches. I tried manual launching option but it didn't work either. (it never prompted me to launch the app).

I tried this on my another app which doesn't have a lot of dependency, and detox works there, so this is some configuration issue on my part or bug in a library, I am not sure.

What was the expected behaviour?

No response

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.51.3
React Native version: 0.84.1
Has Fabric (React Native's new rendering system) enabled: Yes
Node version: v24.11.1
Device model: Pixel_3a_API_34_extension_level_7_x86_64
Android version: 13
Test-runner (select one): jest

Detox logs

Detox logs
INSTRUMENTATION_STATUS: test=runDetoxTests
INSTRUMENTATION_STATUS_CODE: -2
INSTRUMENTATION_RESULT: stream=

Time: 0.009
There was 1 failure:
1) runDetoxTests(com.sqlplay.DetoxTest)
java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)V in class Landroidx/test/internal/platform/reflect/ReflectiveMethod; or its super classes (declaration of 'androidx.test.internal.platform.reflect.ReflectiveMethod' appears in /data/app/~~VFsvtmPAUpMUKDhoPvZdhQ==/com.sql_playground-6DYVHpUbCZBgj5B5oiLnZQ==/base.apk!classes2.dex)
        at androidx.test.espresso.base.InputManagerEventInjectionStrategy.<init>(InputManagerEventInjectionStrategy.java:48)
        at androidx.test.espresso.base.BaseLayerModule.provideEventInjector(BaseLayerModule.java:128)
        at androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.provideEventInjector(BaseLayerModule_ProvideEventInjectorFactory.java:40)
        at androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.get(BaseLayerModule_ProvideEventInjectorFactory.java:32)
        at androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.get(BaseLayerModule_ProvideEventInjectorFactory.java:10)
        at androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at androidx.test.espresso.base.UiControllerImpl_Factory.get(UiControllerImpl_Factory.java:56)
        at androidx.test.espresso.base.UiControllerImpl_Factory.get(UiControllerImpl_Factory.java:11)
        at androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:38)
        at androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:12)
        at androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at androidx.test.espresso.DaggerBaseLayerComponent$ViewInteractionComponentImpl.viewInteraction(DaggerBaseLayerComponent.java:165)
        at androidx.test.espresso.Espresso.onView(Espresso.java:88)
        at com.wix.detox.espresso.action.common.utils.UiControllerUtils.getUiController(UiControllerUtils.kt:11)
        at com.wix.detox.espresso.UiControllerSpy$Companion.attachThroughProxy(UiControllerSpy.kt:17)
        at com.wix.detox.espresso.UiControllerSpy$Companion.attachThroughProxy$default(UiControllerSpy.kt:16)
        at com.wix.detox.DetoxMain.initEspresso(DetoxMain.kt:120)
        at com.wix.detox.DetoxMain.run(DetoxMain.kt:29)
        at com.wix.detox.Detox.runTests(Detox.java:127)
        at com.wix.detox.Detox.runTests(Detox.java:94)
        at com.sqlplay.DetoxTest.runDetoxTests(DetoxTest.java:27)

FAILURES!!!
Tests run: 1,  Failures: 1


INSTRUMENTATION_CODE: -1

00:50:20.736 detox[238180] i child-process:SPAWN_END /home/shivam/Android/Sdk/platform-tools/adb -s emulator-14856 shell am instrument -w -r -e detoxServer ws://localhost:44687 -e detoxSessionId 31346b02-e47c-714d-89f5-9488ab17e647 -e debug false com.sql_playground.test/androidx.test.runner.AndroidJUnitRunner exited with code #0
00:50:20.736 detox[238180] i child-process:EXEC_CMD "/home/shivam/Android/Sdk/platform-tools/adb" -s "emulator-14856" reverse --remove tcp:44687
00:50:20.743 detox[238180] i child-process:EXEC_SUCCESS

Device logs

No response

More data, please!

My project configs
buildscript {
    ext {
        buildToolsVersion = "36.0.0"
        minSdkVersion = 24
        compileSdkVersion = 36
        targetSdkVersion = 36
        ndkVersion = "27.1.12297006"
        kotlinVersion = "2.1.20"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        // for firebase
        classpath("com.google.gms:google-services:4.3.15")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
    }
}

 allprojects {
   repositories {
      google()
      maven { 
        url("$rootDir/../node_modules/detox/Detox-android")
      }
     maven { url 'https://www.jitpack.io' }
   }
 }

apply plugin: "com.facebook.react.rootproject"

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'
apply plugin: "org.jetbrains.kotlin.android"

import com.android.build.OutputFile

react {
autolinkLibrariesWithApp()
}

def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = false
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'

def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {
ndkVersion rootProject.ext.ndkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace "com.sqlplay"
sourceSets {
    main {
        assets.srcDirs = ['src/main/assets']
    }
}
defaultConfig {
    applicationId "com.sql_playground"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 54
    versionName "3.1.2"
    testBuildType System.getProperty('testBuildType', 'debug')
    testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    missingDimensionStrategy "store", "play"
}

splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include(*reactNativeArchitectures())
    }
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled false
        proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
    }
}

}

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
androidTestImplementation('com.wix:detox:+')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.3.0'
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
// For WebP support, without animations
implementation 'com.facebook.fresco:webpsupport:3.4.0'
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}

}


```json
{
  "name": "SqlPlay",
  "version": "3.1.2",
  "private": true,
  "scripts": {
    "test": "jest",
    "postinstall": "",
    "postversion": "react-native-version",
    "detox-setup": "detox clean-framework-cache && detox build-framework-cache",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "clean": "react-native-clean-project",
    "check-dependencies": "rnx-dep-check",
    "fix-dependencies": "rnx-dep-check --write",
    "deploy:android": "cd android && bundle exec fastlane beta && cd ..",
    "e2e:build": "detox build --configuration",
    "e2e:test": "detox test --configuration",
    "test:examples": "vitest run tests/examples.spec.ts",
    "knip": "knip",
    "editor": "cd editor; NODE_ENV=production bun run server.ts"
  },
  "dependencies": {
    "@lodev09/react-native-true-sheet": "^3.10.1",
    "@nanostores/react": "^1.1.0",
    "@react-native-clipboard/clipboard": "^1.16.3",
    "@react-native-community/checkbox": "^0.5.20",
    "@react-native-firebase/analytics": "^24.0.0",
    "@react-native-firebase/app": "^24.0.0",
    "@react-native-firebase/messaging": "^24.0.0",
    "@react-native-menu/menu": "^2.0.0",
    "@react-native-picker/picker": "^2.11.4",
    "@react-native-vector-icons/get-image": "^13.0.0",
    "@react-native-vector-icons/ionicons": "^13.1.1",
    "@react-native-vector-icons/material-icons": "^13.1.1",
    "@react-navigation/bottom-tabs": "^7.16.1",
    "@react-navigation/native": "^7.2.4",
    "@react-navigation/native-stack": "^7.15.1",
    "@shikijs/core": "^4.0.2",
    "@shikijs/langs": "^4.0.2",
    "@shikijs/themes": "^4.0.2",
    "@shopify/flash-list": "^2.3.1",
    "@swan-io/react-native-browser": "^1.1.0",
    "lodash-es": "^4.18.1",
    "nanostores": "^1.2.0",
    "react": "19.2.3",
    "react-native": "0.84.1",
    "react-native-bouncy-checkbox": "^4.1.4",
    "react-native-code-highlighter": "^1.3.0",
    "react-native-device-info": "^15.0.2",
    "react-native-enriched-markdown": "^0.6.0",
    "react-native-file-access": "^4.0.3",
    "react-native-gesture-handler": "^2.31.2",
    "react-native-google-mobile-ads": "^16.3.3",
    "react-native-haptic-feedback": "^3.0.0",
    "react-native-iap": "^15.3.1",
    "react-native-keyboard-controller": "^1.21.7",
    "react-native-marked": "^8.0.1",
    "react-native-mmkv-storage": "^12.0.1",
    "react-native-nitro-modules": "^0.35.7",
    "react-native-nitro-sqlite": "^9.6.0",
    "react-native-notifier": "^2.0.0",
    "react-native-pager-view": "^8.0.2",
    "react-native-reanimated": "^4.3.1",
    "react-native-safe-area-context": "^5.8.0",
    "react-native-screens": "^4.25.2",
    "react-native-share": "12.0.11",
    "react-native-startup-time": "^2.1.0",
    "react-native-svg": "^15.15.5",
    "react-native-tab-view": "^4.3.0",
    "react-native-worklets": "^0.8.3",
    "sonic-memoize": "^1.1.3",
    "sp-react-native-in-app-updates": "^1.5.0",
    "valibot": "^1.4.0",
    "wretch": "^3.0.7"
  },
  "devDependencies": {
    "@babel/core": "^7.28.5",
    "@babel/preset-env": "^7.28.5",
    "@babel/runtime": "^7.28.4",
    "@react-native-community/cli": "20.1.0",
    "@react-native-community/cli-platform-android": "20.1.0",
    "@react-native-community/cli-platform-ios": "20.1.0",
    "@react-native/babel-preset": "^0.84.1",
    "@react-native/eslint-config": "0.84.1",
    "@react-native/metro-config": "^0.84.1",
    "@react-native/typescript-config": "^0.84.1",
    "@tsconfig/react-native": "^3.0.7",
    "@types/jest": "^30.0.0",
    "@types/lodash-es": "^4.17.12",
    "@types/node": "^24.10.0",
    "@types/react": "^19.2.3",
    "@types/react-native-vector-icons": "^6.4.18",
    "@types/react-syntax-highlighter": "^15.5.13",
    "@types/react-test-renderer": "^19.1.0",
    "babel-jest": "^30.2.0",
    "babel-loader": "^10.0.0",
    "babel-plugin-module-resolver": "^5.0.2",
    "bun-types": "^1.3.2",
    "chokidar": "^4.0.3",
    "detox": "^20.51.3",
    "eslint": "^9.39.1",
    "eslint-plugin-jest": "^29.1.0",
    "jest": "^30.2.0",
    "jest-html-reporters": "^3.1.7",
    "knip": "^5.69.0",
    "metro-react-native-babel-preset": "0.77.0",
    "patch-package": "^8.0.1",
    "prettier": "^3.6.2",
    "react-native-svg-transformer": "^1.5.3",
    "react-native-version": "^4.0.0",
    "react-test-renderer": "19.2.6",
    "shiki": "^4.0.2",
    "tailwindcss": "3",
    "terser-webpack-plugin": "^5.3.14",
    "ts-jest": "^29.4.5",
    "typescript": "^5.9.3",
    "webpack": "^5.102.1"
  },
  "engines": {
    "node": ">=22.11.0"
  },
  "trustedDependencies": [
    "@firebase/util",
    "core-js",
    "core-js-pure",
    "detox",
    "dtrace-provider",
    "protobufjs",
    "react-native-nitro-modules",
    "react-native-nitro-sqlite",
    "react-native-quick-sqlite",
    "sharp",
    "unrs-resolver"
  ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions