https://developer.android.com/guide/components/activities/activity-lifecycle#alc

Error
C:\Users\Chris\IdeaProjects\MyApplication3\app\src\androidTest\java\com\example\myapplication\ExampleInstrumentedTest.java:5: error: package androidx.test.ext.junit.runners does not exist
import androidx.test.ext.junit.runners.AndroidJUnit4;
opening the java class you can see the the import does not exist:
import androidx.test.ext.junit.runners.AndroidJUnit4;
To fix the issue open app/build.grade and include the line:
androidTestImplementation ‘androidx.test.ext:junit:1.1.1’
apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.example.myapplication" minSdkVersion 19 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.navigation:navigation-fragment:2.0.0' implementation 'androidx.navigation:navigation-ui:2.0.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1' }
for Intellij IDEA to detect your Android device the phone driver must be installed aswell as the Google USB Driver
Tools > Android > SDK Manager > Google USB Driver
In my case I was required to download a Pixel XL 2 Driver.
restart Intellij and connect your phone