jeudi 8 septembre 2016

Android Studio skipping some tasks while running clean Project

I am beginning to write some instrumentation test cases using Espresso framework. I have included the necessary dependencies in the build.gradle file. I have also set testInstrumentationRunner.

     dependencies {
      //Some more dependencies
     androidTestCompile 'junit:junit:4.12'
     androidTestCompile 'com.android.support.test:runner:0.5'
     androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 
     }

    defaultConfig {
      minSdkVersion 14
      targetSdkVersion 23
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
   }

After building the project, I can see all the relevant jars in $module/build/intermediates/exploded-aar folder. But Android Studio is not able to recognize the files related to Espresso in the test files.

enter image description here

I have tried the following things so far.

  • Sync Project in Android Studio
  • Clean Project
  • Make module
  • Restart Android studio

But none of them solves my problem. On Gradle console, I saw the Android studio is skipping all the tasks related to Android Tests.

:app:processDebugAndroidTestManifest SKIPPED
:app:compileDebugAndroidTestRenderscript SKIPPED
:app:generateDebugAndroidTestBuildConfig SKIPPED
:app:mergeDebugAndroidTestAssets SKIPPED
:app:generateDebugAndroidTestResources SKIPPED
:app:mergeDebugAndroidTestResources SKIPPED
:app:processDebugAndroidTestResources SKIPPED
:app:generateDebugAndroidTestSources SKIPPED

But I have not written any specific gradle code to skip these tasks. So why are these tasks being skipped even after clean build? If somehow these tasks don't get skipped, then Android Studio will be able to recognize these files.

Aucun commentaire:

Enregistrer un commentaire