Android(安卓)Studio4如何在查看低版本API类的源代码?
16lz
2021-01-24
最近因为需要兼容旧版本的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'}
更多相关文章
- android的简单入门学习
- android studio + ndk + cmake + jna +sqlite c层报错SQLITE_CAN
- android 数据储存——--文件存储(2)
- 安卓Android手机系统内文件夹目录解释
- 使用AChartEngine画柱状图
- [Android菜鸟笔记]Android(安卓)Studio_2.3.3小白入门简单配置
- 深入理解:Android(安卓)编译系统
- ffmpeg 编译android so库文件
- AndroidX