ApplicationTestCase deprecated in API level 24

后端 未结 2 1627
一生所求
一生所求 2021-02-06 23:32

I created a default empty project on Android Studio 2.1.2 with API 24. In the sample project, Google offers a depreciated class Applica

2条回答
  •  盖世英雄少女心
    2021-02-06 23:57

    As indicated in the API documentation the API has been deprecated and instead use of the InstrumentationRegistry.getTargetContext() will in turn call onCreate method of your Application class.

    The getTargetContext will call the ApplicationStartupService class defined in Android Manifest as below.

        
         

    https://developer.android.com/reference/android/test/ApplicationTestCase

提交回复
热议问题