Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Resources$NotFoundException: String resource ID #0x7f0e001b #911

Open
loomdoom opened this issue Sep 6, 2023 · 3 comments
Open

.Resources$NotFoundException: String resource ID #0x7f0e001b #911

loomdoom opened this issue Sep 6, 2023 · 3 comments

Comments

@loomdoom
Copy link

loomdoom commented Sep 6, 2023

Appium 2.1.3
espresso-driver 2.25.6

I'm building espresso-server on the fly in test so i use it like this:

Confugration
val capabilities = DesiredCapabilities()
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android")
        capabilities.setCapability(
            MobileCapabilityType.APP,
            "${File(".").absolutePath}/../{redacted}/app/build/outputs/apk/debugTest/app-debugTest.apk"
        )
        capabilities.setCapability(MobileCapabilityType.UDID, "5QBYD22823000300")

        capabilities.setCapability("forceEspressoRebuild", "true")
        capabilities.setCapability("showGradleLog", true)
        capabilities.setCapability("tmpDir", "./espresso-server")
        // Workaround for Espresso driver and Jetpack compose compatibility
        val espressoBuildConfig = """
            {
                "toolsVersions": { 
                    "compileSdk": "33",
                     "targetSdk": "32",
                     "minSdk": "29"
                },
                "additionalAndroidTestDependencies": [
                    "androidx.core:core-ktx:1.10.1",
                    "androidx.appcompat:appcompat:1.6.1",
                    "androidx.constraintlayout:constraintlayout:2.1.4",
                    "androidx.legacy:legacy-support-v4:1.0.0",
                    "com.google.android.material:material:1.9.0",
                    "androidx.activity:activity-ktx:1.7.2",
                    "com.google.android.material:material:1.2.0",
                    "app.rive:rive-android:4.0.0",
                    "androidx.camera:camera-core:1.2.3",
                    "androidx.camera:camera-camera2:1.2.3",
                    "androidx.camera:camera-lifecycle:1.2.3",
                    "androidx.camera:camera-view:1.2.3",
                    "androidx.lifecycle:lifecycle-livedata-ktx:2.6.1",
                    "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1",
                    "androidx.navigation:navigation-fragment-ktx:2.6.0",
                    "androidx.navigation:navigation-ui-ktx:2.6.0"
                ]
            }
        """.trimIndent()
        capabilities.setCapability("espressoBuildConfig", espressoBuildConfig)
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, io.appium.java_client.remote.AutomationName.ESPRESSO)
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, true)
        try {
            Companion.driver = AppiumDriver(URL("http://0.0.0.0:4723"), capabilities).apply {
                setSetting("driver", "compose")
            }

When it's run on device i get the following callstack:

FATAL EXCEPTION: main
                 Process: <redacted>, PID: 20658
                 java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: android.content.res.Resources$NotFoundException: String resource ID #0x7f0e001b
                 	at android.app.ActivityThread.installProvider(ActivityThread.java:8562)
                 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:8094)
                 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7941)
                 	at android.app.ActivityThread.access$2600(ActivityThread.java:278)
                 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2527)
                 	at android.os.Handler.dispatchMessage(Handler.java:109)
                 	at android.os.Looper.loop(Looper.java:228)
                 	at android.app.ActivityThread.main(ActivityThread.java:9105)
                 	at java.lang.reflect.Method.invoke(Native Method)
                 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:614)
                 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1129)
                 Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f0e001b
                 	at android.content.res.Resources.getText(Resources.java:496)
                 	at android.content.res.Resources.getString(Resources.java:592)
                 	at android.content.Context.getString(Context.java:645)
                 	at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:216)
                 	at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
                 	at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
                 	at android.content.ContentProvider.attachInfo(ContentProvider.java:2393)
                 	at android.content.ContentProvider.attachInfo(ContentProvider.java:2361)
                 	at android.app.ActivityThread.installProvider(ActivityThread.java:8557)
                 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:8094) 
                 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7941) 
                 	at android.app.ActivityThread.access$2600(ActivityThread.java:278) 
                 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2527) 
                 	at android.os.Handler.dispatchMessage(Handler.java:109) 
                 	at android.os.Looper.loop(Looper.java:228) 
                 	at android.app.ActivityThread.main(ActivityThread.java:9105) 
                 	at java.lang.reflect.Method.invoke(Native Method) 
                 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:614) 
                 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1129) 
  • androidx.startup-runtime comes from "app.rive:rive-android:4.0.0". and as far as i know it's not used directly anywhere in the code
  • i've checked resources.arsc inside builtapk and there is a string with given id ("androidx_startup")
    obraz
  • i've checked other issues with ResourceNotFound (Drawable one)

Any ideas?

@kesavaIndla
Copy link

@loomdoom Seeing the same issue , Are you able to resolve this issue?

@loomdoom
Copy link
Author

I dont remember what finally made it to work but
what actually worked for me looked like this:


 init {

        dadb.terminateApp("com.redacted.app.automatedTest")

        appiumLocalServer = startHostServer()

        var errorThrown = true
        try {
            val capabilities = DesiredCapabilities()
            capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android")
            capabilities.setCapability(MobileCapabilityType.UDID, dadb.toString())
            capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, ANDROID_UIAUTOMATOR2)
            //capabilities.setCapability(MobileCapabilityType.APP, apkPath)
            capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 0)

            //capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.redacted.app.automatedTest")
            //capabilities.setCapability(MobileCapabilityType.NO_RESET, true)

            extraCaps.asMap().forEach {
                capabilities.setCapability(it.key, it.value)
            }

            val androidDriver = AndroidDriver(URL("http://0.0.0.0:$appiumPort"), capabilities).apply {
                setSetting("driver", "compose")
            }

            installApp(androidDriver, apkPath)
            androidDriver.activateApp("com.redacted.app.automatedTest")


            driver = androidDriver
            instrumentationClient = InstrumentationClient(instrumentationPort)
            println(dadb.forward(instrumentationPort, 8080))
            errorThrown = false
        } catch (e: MalformedURLException) {
            e.printStackTrace()
            throw (e)
        } catch (e: Exception) {
            println(e.message)
            throw (e)
        } finally {
            if (errorThrown) {
                close()
            } else {
                instances.add(this)
            }
        }
    }

there were other issues like e.g. app install uninstall that i had to do using adb(dadb variable in code above) client or running custom instrumentation http server(embedded in app's test variant and client impl using retrofit - InstrumentationClient in code above)

@yaoyue1019
Copy link

I got the same issue,at last found there are 2 application in different moudules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants