I try to use the Espresso driver for Appium. The test APK is signed with the debug key of the app.
Starting the app from the launcher in the emulator works.
Launching the MainActivity in the instrumentation fails.
For some reason loading the resource that is assigned to the windowBackground attribute is different when AppCompat library loads it than we would try it in the MainActivity.
int[] sWindowBackgroundStyleable = {android.R.attr.windowBackground};
final TintTypedArray a = TintTypedArray.obtainStyledAttributes(this, null, sWindowBackgroundStyleable);
int resourceId = a.getResourceId(0, 0);
Log.wtf(TAG, "Used resourceId for windowBackground: " + resourceId);
In our MainActivity 2131231370 -> 0x7F08028A that’s the correct resource. But AppCompatDelegateImpl. a different id is resolved, which is by coincidence a dimension.
Anyone an idea?
Thanks.
Mike
02-12 15:52:27.066 10442 10442 E MainActivity: Used resourceId for windowBackground: 2131231370
02-12 15:52:27.223 10442 10442 E MonitoringInstr: Exception encountered by: com.our.package.MainActivity@1dc3231. Dumping thread state to outputs and pining for the fjords.
02-12 15:52:27.223 10442 10442 E MonitoringInstr: android.content.res.Resources$NotFoundException: Drawable com.our.package.dev:dimen/action_button_min_width_wtf with resource ID #0x7f070059
02-12 15:52:27.223 10442 10442 E MonitoringInstr: Caused by: android.content.res.Resources$NotFoundException: Resource “com.our.package.dev:dimen/action_button_min_width_wtf” (7f070059) is not a Drawable (color or path): TypedValue{t=0x5/d=0xc801 a=2 r=0x7f070059}
android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:786)
android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:631)
android.content.res.Resources.getDrawableForDensity(Resources.java:888)
android.content.res.Resources.getDrawable(Resources.java:827)
android.content.Context.getDrawable(Context.java:626)
androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:463)
androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:203)
androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
androidx.appcompat.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:753)
androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
androidx.appcompat.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:86)
androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:260)
androidx.appcompat.app.AppCompatDelegate.create(AppCompatDelegate.java:182)
androidx.appcompat.app.AppCompatActivity.getDelegate(AppCompatActivity.java:520)
androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
com.our.package.base.BaseActivity.onCreate(BaseActivity.java:282)
com.our.package.MainActivity.onCreate(MainActivity.java:115)
android.app.Activity.performCreate(Activity.java:7136)
android.app.Activity.performCreate(Activity.java:7127)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:674)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loop(Looper.java:193)
android.app.ActivityThread.main(ActivityThread.java:6669)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)