question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resources$NotFoundException Resource is not a Drawable

See original GitHub issue

Appium v1.12.0 I’m not very familiar with Appium, this is my first crack at this.

I get the following exception when I try to start an Appium session with espresso. The crash is happening in the onCreate method of all my activities (I’ve tried starting with different activities) via androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:71). This crash does not happen when I change the driver to UiAutomator2, run the app on its own, or run my Espresso test suite. The crash only occurs when I run through Appium via the Espresso driver.

My config JSON:

{
  "deviceName": "P500",
  "platformName": "Android",
  "platformVersion": 21,
  "automationName": "Espresso",
  "app": "C:\\builds\\redacted-debug.apk",
  "appPackage": "com.redacted.debug",
  "udid": "123456789",
  "appActivity": "com.redacted.activity.SplashActivity",
  "noReset": true,
  "skipUnlock": true
}

Exception Stack trace:

04-26 22:29:07.231 31232 31232 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.redacted.debug/com.redacted.activity.SetupActivity}: android.content.res.Resources$NotFoundException: Resource "com.redacted.debug:dimen/cockpit_section_status_max_width" (7f070059)  is not a Drawable (color or path): TypedValue{t=0x5/d=0x25801 a=2 r=0x7f070059}
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.ActivityThread.access$800(ActivityThread.java:151)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.os.Handler.dispatchMessage(Handler.java:102)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.os.Looper.loop(Looper.java:135)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.ActivityThread.main(ActivityThread.java:5257)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at java.lang.reflect.Method.invoke(Native Method)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at java.lang.reflect.Method.invoke(Method.java:372)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
04-26 22:29:07.231 31232 31232 E AndroidRuntime: Caused by: android.content.res.Resources$NotFoundException: Resource "com.redacted.debug:dimen/cockpit_section_status_max_width" (7f070059)  is not a Drawable (color or path): TypedValue{t=0x5/d=0x25801 a=2 r=0x7f070059}
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.content.res.Resources.loadDrawableForCookie(Resources.java:2441)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.content.res.Resources.loadDrawable(Resources.java:2381)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.content.res.Resources.getDrawable(Resources.java:787)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.content.Context.getDrawable(Context.java:403)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:463)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:203)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:753)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:86)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:260)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.app.AppCompatDelegate.create(AppCompatDelegate.java:182)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.app.AppCompatActivity.getDelegate(AppCompatActivity.java:520)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at com.redacted.activity.SetupActivity.onCreate(SetupActivity.java:125)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.Activity.performCreate(Activity.java:6013)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:674)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
04-26 22:29:07.231 31232 31232 E AndroidRuntime:       ... 10 more

Trying with Appium 1.13.0 gives me a different error:

[debug] [MJSONWP] Encountered internal error running command: Error: java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner} from pid=13136, uid=13136 not allowed because package io.appium.espressoserver.test does not have a signature matching the target com.redacted.debug

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:62 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
TarCVcommented, Aug 28, 2019

I’ve managed to fix it for our app by changing this driver:

  • changed all SDK versions in both build.gradle and server manifest to match versions in AUT
  • disabled transitive dependencies for espresso-contrib (I guess these dependencies are main cause for this issue)
  • excluded androidx.test.espresso group from transitive dependencies of espresso-web

Overall I think Android build process is too complex to have espresso server setup as simple as it is now. I’d be much more confident in the server if it had most android dependencies compileOnly and its manifest were generated based on AUT manifest.

7reactions
sfkircommented, Jul 31, 2019

But crash doesn’t happen when I run Espresso tests. This only happen when I run my Appium tests with Espresso driver.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Resources$NotFoundException: File res/drawable ...
Resources$NotFoundException : File res/drawable/ , I want to share that this exception might caused by your foo.xml contains improper code.
Read more >
Resource is not a Drawable (color or path): TypedValue{t=0x1 ...
This bug was filed from the Socorro interface and is report bp-a9a98dd0-ac50-427f-aac4-732972141208.
Read more >
Caused by android.content.res.Resources ... - GitHub
No Reproduction steps 1 in PlayerView Construct(), ... Resources$NotFoundException Drawable (missing name) with resource ID #0x7f08009c # ...
Read more >
Resources.NotFoundException - Android Developers
public static class Resources.NotFoundException ... This exception is thrown by the resource APIs when a requested resource can not be found.
Read more >
Resources$NotFoundException for drawable that is part of ...
Hello, Crash report from our customers report that android was not able to find a drawable that was being referenced in my code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found