我使用的是Android Studio 1.5.1(稳定频道),Gradle插件1.5,Gradle 2.7.
问题是AndroID Studio无法识别与Espresso(而不仅仅是)相关的任何导入
所以,我试图清理项目,重建,使缓存无效并重新启动,但没有.
我在我的app模块中添加了这些依赖项:
androIDTestCompile 'com.androID.support.test.espresso:espresso-core:2.2.1'androIDTestCompile 'com.androID.support:support-annotations:23.1.1'androIDTestCompile 'com.androID.support.test:runner:0.4.1'androIDTestCompile 'com.androID.support.test:rules:0.4.1'
我在defaultConfig中添加了runner:
testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner"
我在androIDTest文件夹下创建了测试套件类:
我做错了什么?
UPDATE
这是我的build.gradle的(部分):
apply plugin: 'com.androID.application'apply plugin: 'com.neenbedankt.androID-apt'androID { compileSdkVersion 23 buildToolsversion '23.0.2' defaultConfig { minSdkVersion 15 targetSdkVersion 23 versionCode 5 versionname '1.4' testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } buildTypes { //my build type configs } packagingOptions { exclude 'meta-inf/services/javax.annotation.processing.Processor' exclude 'meta-inf/liCENSE' exclude 'meta-inf/liCENSE.txt' exclude 'meta-inf/NOTICE' exclude 'meta-inf/NOTICE.txt' } lintoptions { disable 'InvalIDPackage' } dexOptions { incremental true preDexlibrarIEs = false jumboMode = false javaMaxHeapSize "2g" }}dependencIEs { compile filetree(include: ['*.jar'],dir: 'libs') compile 'com.vIEwpagerindicator:library:2.4.1' compile project(':librarIEs:RITracking') compile 'com.androID.support:support-v4:23.1.1' compile 'com.androID.support:design:23.1.1' compile 'com.androID.support:support-annotations:23.1.1' compile 'com.androID.support:recyclervIEw-v7:23.1.1' compile 'com.androID.support:cardvIEw-v7:23.1.1' compile 'com.androID.support:grIDlayout-v7:23.1.1' compile 'com.Google.code.gson:gson:2.5' compile 'com.Google.androID.gms:play-services-plus:8.4.0' compile 'com.Google.androID.gms:play-services-base:8.4.0' compile 'de.greenrobot:eventbus:2.4.1' compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.squareup.okhttp:okhttp:2.7.2' compile 'com.facebook.androID:facebook-android-sdk:4.9.0' compile 'com.cocosw:bottomsheet:1.2.0@aar' //Bottom Sheet that implement material design used for ShareDialog compile 'com.github.bumptech.glIDe:glIDe:3.6.1' //GlIDe library compile 'com.Googlecode.libphonenumber:libphonenumber:7.2.3' //library used to parse/merge phones number to E164 format compile 'me.leolin:ShortcutBadger:1.1.3@aar' //Used to show badge on application icon,library is optimized to work on most of devices compile 'com.stripe:stripe-androID:1.0.3' //Stripe payment gateway,used to integrate credit card payment provIDed 'org.projectlombok:lombok:1.16.6' apt "org.projectlombok:lombok:1.16.6" compile 'com.jakewharton:butterknife:7.0.1' apt "com.jakewharton:butterknife:7.0.1" compile 'de.greenrobot:greendao:2.1.0' //Green Dao library is ORM implementation for AndroID sql lite compile files('libs/libammsdk.jar') compile files('libs/apptimize-androID-2.9.1.jar') testCompile 'junit:junit:4.12' androIDTestCompile "com.androID.support:support-annotations:23.1.1" androIDTestCompile 'com.androID.support.test.espresso:espresso-core:2.2.1' androIDTestCompile 'com.androID.support.test.espresso:espresso-intents:2.2.1' androIDTestCompile('com.androID.support.test.espresso:espresso-contrib:2.2.1') { exclude group: 'com.androID.support',module: 'appcompat' exclude group: 'com.androID.support',module: 'support-v4' exclude module: 'recyclervIEw-v7' } androIDTestCompile 'com.androID.support.test:runner:0.4.1' androIDTestCompile 'com.androID.support.test:rules:0.4.1'}解决方法 更新2016年11月30日
就像@Jaymes Bearden在下面的评论中所说的那样.
使用testBuildType. AndroID Studio 2.2,gradle 2.2.2
androID { testBuildType "yourBuildType"}
老答复
我发现不是解决方案,而是一些问题的根源.在我的项目中,我有很多BuildTypes.特别是多个调试版本.
一切都只在默认的调试版本类型中有效.我认为这是一些内部AndroID Studio错误.
我的AS版本 – 2.1
总结以上是内存溢出为你收集整理的Android Studio无法识别Espresso导入全部内容,希望文章能够帮你解决Android Studio无法识别Espresso导入所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)