最近因为需要兼容旧版本的Android API,在编程时需要调用旧版本的类方法,但是因为build.gradle里面对应的编译版本是29,所以ctrl+点击函数,调到的源代码文件也是sdk29的文件,那么这里我们就可以直接修改编译版本,然后sync gradle,就可以查看的了,不过编译的时候你需要改回来的哦。
apply plugin: 'com.android.application'
android {
// compileSdkVersion 29 //现在使用的版本
compileSdkVersion 22 //查看旧代码时需要的版本
defaultConfig {
applicationId "com.xxxxx"
minSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner