4

I have a project with multiple modules, and after updating to Gradle Plugin 3.4.0 and Gradle 5.1.1, everything else seems to work OK, but the module for Espresso tests crashes immediately when trying to run the tests:

android.content.res.Resources$NotFoundException: Drawable com.example.foo:dimen/activity_default_margin with resource ID #0x7f070059
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.foo:dimen/activity_default_margin" (7f070059) is not a Drawable (color or path): TypedValue{t=0x5/d=0x3201 a=2 r=0x7f070059}
  at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:786)
  at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:631)
  at android.content.res.Resources.getDrawableForDensity(Resources.java:888)
  at android.content.res.Resources.getDrawable(Resources.java:827)
  at android.content.Context.getDrawable(Context.java:626)
  at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:463)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:203)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
  at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:753)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
  at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:86)
  at android.support.v7.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:260)
  at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:182)
  at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:520)
  at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
  at com.example.foo.BaseActivity.onCreate(BaseActivity.java:160)

What could cause this? I first suspected it was R8 being enabled by default starting from 3.4.0, but disabling it didn't help at all. I've cleaned the project multiple times and invalidated caches, and nothing helps.

The resource ID is really a dimen resource as it says in the stack trace, and it's only used in a layout which is not even used in the test in question. The crash happens immediately in the test activity's onCreate().

Bulat
  • 720
  • 7
  • 15
manabreak
  • 5,415
  • 7
  • 39
  • 96

0 Answers0