最近因为需要兼容旧版本的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 "androidx.test.runner.AndroidJUnitRunner"
}
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.fragment:fragment:1.2.5'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
本文地址:https://blog.csdn.net/poolooloo/article/details/107400799
如对本文有疑问, 点击进行留言回复!!
LongClick原理、上下文菜单原理、EditText长按弹窗原理、WebView长按弹窗自定义、修复WebView全选重复bug ———————————————— 版权声明:本文为CSDN博主「
JobScheduler 实现 特定时间,特定条件(系统空闲,电池电量,磁盘空间 ……)下执行任务
网友评论