「instrumentTest」から「androidTest」に変更になってるのが Gradle plugin for Android 0.9

Android Studio アップデートです。

Android_Studio_0_5_1_Released_-_Android_Tools_Project_Site

Android Studio 0.5.1 Released - Android Tools Project Site

多分、いきなりテストでこんなエラーが出始めた人多いと。

Failed to refresh Gradle project 'SampleProject'
The project is using an unsupported version of the Android Gradle plug-in (0.7.3).
Version 0.9.0 introduced incompatible changes in the build language.
Please read the migration guide to learn how to update your project.
Open migration guide, fix plug-in version and re-import project

Android_Studio__Preview__0_5_1

この件、Gradle plugin for Android についてマイグレーションなアナウンスがでています。

Instrumentation Tests
If you have instrumentation tests (or other types of tests) in your project, note that we changed the name and folder from instrumentation tests to android tests to reflect the fact that this facility is not just for instrumentation tests but for plain JUnit tests (running on a device) and eventually also UI automator tests.

To update your project
Rename your instrumentTest folders to androidTest, e.g. git mv app/src/instrumentTest app/src/androidTest.
Alternatively you can tell gradle to keep using the old folder by relocating your sourcesets.
Update any test dependencies from instrumentTestCompile to androidTestCompile:
dependencies {
-    instrumentTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
+    androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
} 

テストディレクトリ名を「instrumentTest」を「androidTest」に変えなさい、と。

該当ディレクトリから右クリックで[Refactor]-[Rename]にて変更します。

rename

rename2

再度、テスト実行。

ActivityTest_java

てなかんじで動くようになりました。

その他、アナウンスには以下も記述されています。

Libraries

The DSL for the library projects is now the same as for the application projects. This means you can create more build types, and create flavors.
You can create/configure more build types, in the buildTypes { ... } container.
You can create product flavors using the productFlavors { ... } container.
You can create signingConfigs using the signingConfigs { ... } container.
For example if you have in your library:

android {
    debug {
    }
    release {
    }
    debugSigningConfig {
    }
}

You would replace it with:

android {
    buildTypes {
        debug {
        }
        release {
        }
    }
    signingConfigs {
        debug {
        }
    }
}

要注意です。

Migrating From 0.8 to 0.9 - Android Tools Project Site


関連ワード:  AndroidAndroidStudioGradle