Android AS升级3.1 编译报错:The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin.
AndroidStudio升级到3.1后编译报错:The SourceSet ‘instrumentTest’ is not recognized by the Android Gradle Plugin.
项目中 gradle 配置
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
原因
是这里出问题了 instrumentTest.setRoot(‘tests’) ,你可能在升级 Android Studio 时更新了项目的 gradle 配置,这里的配置中 instrumentTest 已被弃用,不适用于现在的 gradle 版本。
解决办法
用 androidTest 替换 instrumentTest,编译运行即可。
Android AS升级3.1 编译报错:The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin.的更多相关文章
- cocos2d-x在android中响应返回键编译报错的bug分析
先看一段代码如何在Android中加入返回按键的响应 <span style="font-size:18px;">自己派生CCKeypadDelegate的子类,然后注 ...
- RK3399 Android 7.1 删除repo后编译报错
CPU:RK3399 系统:Android 7.1 瑞芯微使用的是 repo 来进行代码管理,但我们需要用 git 来管理,所以就删除了 repo,但是编译就报错,如下:Server is alrea ...
- ios 12 xcode10 新升级的编译报错libstdc++.6.0.9 Multiple commands produce
问题一 编译报错 Showing Recent Messages :-1: Multiple commands produce '/Users/duning/Library/Developer/Xco ...
- 一些webpack常见编译报错的解决方案
重新安装依赖可以解决80%的webpack编译报错问题. rm -rf node_modules rm package-lock.json npm cache clear --force npm in ...
- 使用C#模拟Outlook发送邮件,代码编译报错
添加OutLook API using OutLook = Microsoft.Office.Interop.Outlook; 发送邮件方法 public void SendEmail() { Out ...
- Android Studio使用org.apache.http报错
Android Studio使用org.apache.http报错需要加上这句话:useLibrary 'org.apache.http.legacy'
- cordova编译报错:Execution failed for task ':processDebugResources'
cordova编译报错:Execution failed for task ':processDebugResources' 引发这个错误的最扩祸首就是一个中文命名的文件,不知道什么时候加入的,我写了 ...
- 编译报错dereferencing pointer to incomplete type
关于编译报错“dereferencing pointer to incomplete type... 多是没找到结构体的定义,可以在本地复制其定义试试. 参考: http://my.oschina.n ...
- Maven-010-maven 编译报错:Failure to ... in ... was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced.
今晚在编译 maven 项目的时候,命令行报错,出现 Failure to ... in ... 类似错误,详细的错误信息如下所示: [INFO] -------------------------- ...
随机推荐
- Windows多个应用程序共享全局变量,静态变量
默认情况下exe不同实例使用copy-on-write技术避免共享数据,比如运行了两个exe,最开始它们使用的都是一份虚拟内存页,然后第一个实例修改了全局变量, 这时候COW就会复制那一页,然后将第一 ...
- FPGA基础学习(2) -- FIFO IP核(Quartus)
ALTERA在LPM(library of parameterized mudules)库中提供了参数可配置的单时钟FIFO(SCFIFO)和双时钟FIFO(DCFIFO).FIFO主要应用在需要数据 ...
- I2C(smbus pmbus)和SPI分析
2C和SPI作为两种非常常用的低速外部总线 I2C I2C是以前的飞利浦半导体制定的标准,也就是如今的NXP. I2C总线由一条数据线(SDA)和一条时钟线(SCL)组成.设备分主从,主设备提供时钟, ...
- Luogu P1503 鬼子进村 set
还是拿set搞... 用set记录每个被摧毁的位置,Q的时候二分一下,在和上一个摧毁的位置减一下,即可求出能到的房子数 #include<iostream> #include<cst ...
- ZOJ3068(01分数规划)
本是POJ2976,喜闻乐见的01规划入门题.POJ日常假死,到ZOJ测. 二分答案. 试了试数据好像没问题,\(a_i\)总是小于\(b_i\)且最终预答案l都小于1.然而为什么我把r设成1e10往 ...
- Educational Codeforces Round 11 B
Description Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of th ...
- java读取配置到Hash表里
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; im ...
- 函数之-------------------------HR管理操作
import os import time def emplog(content): #记录操作的一个函数,在删除,添加,修改都会用到这一操作, f=open("emp.log", ...
- Java8 流的使用示例
foreach遍历处理 dataList.stream().forEach(index -> sb.append(dataList.get(index) + "',")); ...
- flume failed to start agent because dependencies were not found in classpath
FLUME_CLASSPATH=/root/flume/lib/ copied comon jar files from hadoop folder to the flume folder. cp / ...