最近因为需要兼容旧版本的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'}

更多相关文章

  1. android的简单入门学习
  2. android studio + ndk + cmake + jna +sqlite c层报错SQLITE_CAN
  3. android 数据储存——--文件存储(2)
  4. 安卓Android手机系统内文件夹目录解释
  5. 使用AChartEngine画柱状图
  6. [Android菜鸟笔记]Android(安卓)Studio_2.3.3小白入门简单配置
  7. 深入理解:Android(安卓)编译系统
  8. ffmpeg 编译android so库文件
  9. AndroidX

随机推荐

  1. 引入第三方库ic_launcher冲突
  2. Android热修复原理(一)热修复框架对比和代
  3. Android(安卓)Studio的GridLayout中使按
  4. android键盘钩子 android按键劫持
  5. Mac下 android 模拟器 host修改
  6. 一篇搞定Android(安卓)Sqlite
  7. Android 下通过jni读取i2c数据
  8. android调用matlab中的函数方法
  9. android launcher客制化——将自己的apk
  10. Android(安卓)Service启动方式总结