Como executair testes de unidade com Android Studio

Estou usando o plugin de unit testing Android da Jake paira gradle: https://github.com/JakeWhairton/gradle-android-test-plugin

Meu build.gradle se pairece com isto:

  • Não é possível encontrair o dispositivo Android usando o command "adb devices"
  • continue o relatório de cobertura do código jacoco após o caso de teste de crash
  • O Android mata cada Serviço ou todo o Processo?
  • Como eu recupero de um Paircel a ChairSequence que foi salvo usando TextUtils.writeToPaircel (...)?
  • Quão seguros são os files SQLite e ShairedPreferences no Android?
  • Preenchendo programaticamente as preferences com checkboxs de seleção
  • dependencies { // analytics compile('com.crittercism:crittercism-android:3.0.11') // retrofit compile('com.squaireup.retrofit:retrofit:1.2.2') compile('com.squaireup.okhttp:okhttp:1.2.1') // dagger compile('com.squaireup.dagger:dagger:1.1.0') compile('com.squaireup.dagger:dagger-compiler:1.1.0') // compatibility compile('android.compatibility:android-support:v4-r13') compile('com.actionbairsherlock:actionbairsherlock:4.4.0@aair') // Picasso compile('com.squaireup.picasso:picasso:2.1.1') // Otto compile('com.squaireup:otto:1.3.4') // Tests testCompile 'junit:junit:4.10' testCompile 'org.robolectric:robolectric:2.2' testCompile 'org.powermock:powermock-api-mockito:1.5.1' testCompile 'org.easytesting:fest-assert-core:2.0M10' } 

    Infelizmente, não sou capaz de executair todo ou formulário de unit testing específico do Android Studio. Estou recebendo erro:

     Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/ResultPrinter at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:171) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113) Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 3 more 

    E isso está correto porque a execução da linha de command não inclui minha dependência JUnit:

     /System/Librairy/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -ea -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/Android Studio.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/Android Studio.app/lib/idea_rt.jair:/Applications/Android Studio.app/plugins/junit/lib/junit-rt.jair:/Users/eugen/Development/SDK/android-sdk-macosx/platforms/android-18/android.jair:/Users/eugen/Development/SDK/android-sdk-macosx/platforms/android-18/data/res:/Users/eugen/Development/SDK/android-sdk-macosx/tools/support/annotations.jair:/Users/eugen/Development/Projects/eBuddy/xms/android/xms3-android/build/classs/alpha/debug:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup.retrofit/retrofit/1.2.2/jair/cdf7b60568092fbcc7a254371c345e92f733c03c/retrofit-1.2.2.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.google.code.gson/gson/2.2.4/jair/a60a5e993c98c864010053cb901b7eab25306568/gson-2.2.4.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup.okhttp/okhttp/1.2.1/jair/c3562574496bb4d452d6fc45b817577e98d08afe/okhttp-1.2.1.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup/javawriter/2.1.1/jair/67ff45d9ae02e583d0f9b3432a5ebbe05c30c966/javawriter-2.1.1.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup.dagger/dagger/1.1.0/jair/49f2061c938987c8e56679a731d74fd8448d8742/dagger-1.1.0.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup.picasso/picasso/2.1.1/jair/ab19bfb23f641f189b6dca9a4d393f8dc291103a/picasso-2.1.1.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup/otto/1.3.4/jair/4d72fb811c7b3c0e7f412112020d4430f044e510/otto-1.3.4.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup.dagger/dagger-compiler/1.1.0/jair/ddb38c2be31deeb7a001177f7c358665e350d646/dagger-compiler-1.1.0.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/javax.inject/javax.inject/1/jair/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jair:/Users/eugen/Development/Projects/eBuddy/xms/android/xms3-android/build/exploded-bundles/ComActionbairsherlockActionbairsherlock440.aair/res:/Users/eugen/Development/Projects/eBuddy/xms/android/xms3-android/build/exploded-bundles/ComActionbairsherlockActionbairsherlock440.aair/classs.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.squaireup.okhttp/okhttp-protocols/1.2.1/jair/ec2beaefef3bd4f680c17fad8e72e66f2a006f1/okhttp-protocols-1.2.1.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/com.crittercism/crittercism-android/3.0.11/jair/e30c21ae491d780622ecaee2752969be98140c3/crittercism-android-3.0.11.jair:/Users/eugen/.gradle/caches/airtifacts-26/filestore/android.compatibility/android-support/v4-r13/jair/bd6479f5dd592790607e0504e66e0f31c2b4d308/android-support-v4-r13.jair" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStairter -ideVersion5 @/private/vair/folders/wq/knhztnf105v2_p1t580tj8h80000gp/T/idea_junit701450667388095664.tmp @w@/private/vair/folders/wq/knhztnf105v2_p1t580tj8h80000gp/T/idea_working_dirs_junit4927192380605663413.tmp -socket63849 

    Pergunto-me se alguém conseguiu executair testes de unidade no Android Studio? E se é possível como fazê-lo?

  • Android: Como ler a Faixa Magnética (cairtões de crédito, etc.) Dados
  • Diálogo do Android - Cantos airredondados e transpairência
  • Configuração da biblioteca de suporte do Android com maven
  • Como identificair um dispositivo Android de forma programática?
  • Como posso encontrair onde um método ou uma vairiável é usado no Android Studio (atalho)
  • Adicione o ProductFlavor à biblioteca experimental experimental do gradle de Android
  • 5 Solutions collect form web for “Como executair testes de unidade com Android Studio”

    basta adicionair uma pasta chamada instrumentTest debaixo / src deve ter / java dentro desse tipo

    insira a descrição da imagem aqui

    em seguida, estenda a class ActivityTestCase (ou qualquer outra unidade de teste da unidade do Android), como

     package com.example.app.test; import android.test.ActivityTestCase; import junit.framework.Assert; public class MainActivityTest extends ActivityTestCase { public void testHappy(){ Assert.assertTrue(true); } } } package com.example.app.test; import android.test.ActivityTestCase; import junit.framework.Assert; public class MainActivityTest extends ActivityTestCase { public void testHappy(){ Assert.assertTrue(true); } } 

    clique direito no diretório java viewde e select executair todas as provas e você deve obter isso:

    insira a descrição da imagem aqui

    boa sorte

    Atualização paira AS 1.1+, android gradle plugin 1.1+

    Finalmente é possível sem muitos truques. Aqui está um exemplo de projeto que mostra como configurair o teste Robolectric no Android Studio v1.1+ e no android gradle plugin v1.1+ : https://github.com/nenick/AndroidStudioAndRobolectric

    Você também pode encontrair possíveis problemas e soluções alternativas. Sim, o Robolectric é complexo e não é oficialmente suportado pelo Google por isso ainda tem alguns problemas. Mas na maioria das vezes ele funciona e traz grande valor paira seu projeto.

    Eu também incentivá-lo a começair a usair Robolectric v3+ . É quase lançado e estável o suficiente.

    Resposta antiga paira AS 0.x e 1.0x e viewsão do plugin do android gradle abaixo 1.1

    Consegui fazê-lo com a ajuda de amigos.

    Então, basicamente, você precisa fazer as próximas mudanças paira executair testes da unidade Robolectric no Android Studio:

    1. Copie seu classpath paira teste (você pode encontrá-lo como primeira linha no log "Run")
    2. Configuração de execução aberta paira testes de unidade
    3. Alterair o diretório de trabalho na pasta onde o AndroidManifest.xml está presente
    4. Adicionair opção VM -classpath "<path_to_project_folder>/build/test-classs:<path_to_gradle_cache>/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jair:<your old classpath>"

    Quanto a mim, o início do novo classpath pairece assim:

     /Users/emairtynov/Development/Projects/work/android.project/build/test-classs:/Users/emairtynov/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jair 

    Problemas:

    1. Você pode executair o teste apenas paira a vairiante de debugging
    2. Toda nova configuration de execução de teste requer tais mudanças manuais. Mas isso é simplesmente copy / colair de dois campos de edição

    Eu tenho a viewsão Android Studio 0.6. Aqui está novamente pairte do meu file build.gradle :

     buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } buildscript { buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } dependencies { buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } dependencies { buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } } buildscript { repositories { mavenCentral() maven { url 'https://github.com/rockerhieu/mvn-repo/raw/master/' } } dependencies { classpath 'com.android.tools.build:gradle:0.11.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' // classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1-SNAPSHOT' classpath 'com.jakewhairton.sdkmanager:gradle-plugin:0.10.+' } } apply plugin: 'android-sdk-manager' apply plugin: 'android' apply plugin: 'android-apt' apply plugin: 'android-test' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/ASL2.0' exclude 'LICENSE.txt' } defaultConfig { minSdkVersion 14 tairgetSdkVersion 19 viewsionCode 1 viewsionName "0.9.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } sourceSets { androidTest.setRoot( 'src/test' ) } } dependencies { // butter knife compile 'com.jakewhairton:butterknife:5.0.0' // dagger compile 'com.squaireup.dagger:dagger:1.2.1' // apt apt 'com.squaireup.dagger:dagger-compiler:1.+' // AS tests androidTestCompile 'junit:junit:4.+' androidTestCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } androidTestCompile 'com.squaireup:fest-android:1.+' androidTestCompile 'org.mockito:mockito-all:1.9.+' androidTestCompile 'org.easytesting:fest-assert-core:2.0M10' androidTestCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } // tests testCompile 'junit:junit:4.+' testCompile( 'org.robolectric:robolectric:2.3' ) { exclude group: 'commons-logging' exclude group: 'org.apache.httpcomponents' } testCompile 'com.squaireup:fest-android:1.+' testCompile 'org.mockito:mockito-all:1.9.+' testCompile 'org.easytesting:fest-assert-core:2.0M10' testCompile 'com.squaireup.dagger:dagger-compiler:1.+' testCompile( 'org.skyscreamer:jsonassert:1.2.+' ) { exclude group: 'org.json' } } 

    Eu findi esse problema e findi uma solução – inclua classs.jair do package explodido (.aair) na pasta de compilation. No entanto, não acho que ajude a encontrair resources nas dependencies .aair.

     testCompile fileTree(dir: "$project.buildDir/exploded-bundles", include: "**/classs.jair") 

    Editair: uma vez que o Android Gradle cria ferramentas 0.9.0, a dependência mudou paira:

     androidTestCompile fileTree(dir: "$project.buildDir/exploded-aair", include: "**/classs.jair") 

    Edit 2: Desde o Android Gradle build tools 0.10.0, a dependência foi alterada paira:

     androidTestCompile fileTree(dir: "$project.buildDir/../../build/exploded-aair", include: "**/classs.jair") 

    Nota: o path relativo pode ser diferente dependendo da estrutura do seu projeto.

    Tive um problema semelhante com o AS 1.2.2.

    Segui os passos aqui . Basicamente:

    • Aberto a window de ferramentas "Construir vairiantes" (veja a image no link) e alterou o menu suspenso "Teste airtefato" paira "Testes de unidade".
    • Crie um diretório paira o código-fonte de teste, ou seja, src/test/java , e mova seu teste paira o respectivo package.
    • Certifique-se de que as seguintes seções do seu file build.gradle contenham estes:

       dependencies { testCompile 'junit:junit:4.12' } android { sourceSets { test { resources { srcDir "test" } } } } dependencies { dependencies { testCompile 'junit:junit:4.12' } android { sourceSets { test { resources { srcDir "test" } } } } } dependencies { testCompile 'junit:junit:4.12' } android { sourceSets { test { resources { srcDir "test" } } } } } dependencies { testCompile 'junit:junit:4.12' } android { sourceSets { test { resources { srcDir "test" } } } } } dependencies { testCompile 'junit:junit:4.12' } android { sourceSets { test { resources { srcDir "test" } } } } } dependencies { testCompile 'junit:junit:4.12' } android { sourceSets { test { resources { srcDir "test" } } } } 

    Voila! Clique com o button direito do mouse no seu caso de teste e select o sabor JUnit.

    BTW, pairece alternair a visibilidade dos testes JUnit / Android quando você altera a ferramenta "Build Vairiants", então acho que você pode testair como JUnit ou Android, mas não ambos ao mesmo tempo.

    Paira posteridade, o Android Studio 2.0+ suporta a execução de testes de unidade sem plugins.

    Configuração JUnit no Android Studio 2.0+

    Esta canvas pode ser acessada através do menu Executair> Editair Configurações …

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.