Android Studio升级到3.2后,项目出现了一系列问题,导致运行不了!!!
这里面的坑很多,一直提示将 compile 改为 implementation 或者 api
implementation 和 api 有很大区别
升级后的module的build.gradle变化
dependencies下3.0之前写法:
compile fileTree(dir: 'libs', include: ['*.jar'])
dependencies3.0之后写法:
api fileTree(include: '*.jar', dir: 'libs')
或
implementation fileTree(include: '*.jar', dir: 'libs')
这里面的巨坑就在上面!!!!!!!!!!
这里面的巨坑就在上面!!!!!!!!!!
这里面的巨坑就在上面!!!!!!!!!!
api 指令
完全等同于compile指令,没区别,你将所有的compile改成api,完全没有错。
implement指令
这个指令的特点就是,对于使用了该命令编译的依赖,对该项目有依赖的项目将无法访问到使用该命令编译的依赖中的任何程序,也就是将该依赖隐藏在内部,而不对外部公开。类似private
sourceSets3.0之前写法:
instrumentTest.setRoot('tests')
sourceSets3.0之后写法:
androidTest.setRoot('tests')