如何使 compileSdkVersion 等于或高于显示的选项

how to get compileSdkVersion equal or higer than the options shown

我正在使用 AdMob 制作一个带有广告的应用程序:https://developers.google.com/admob/android/quick-start?hl=he

为此,我需要“compileSdkVersion 28 或更高版本”,所以当我尝试通过以下方式更改它时: 右击“应用”>打开模块设置>编译SDK版本,我看到最大选项是:编译SDK版本27,而不是28 Google AdMob

的最低要求

这也是我的 build.gradle(模块:app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.admin.minesweeperyannai"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.android.gms:play-services-ads:19.4.0'//Google AdMob dependency
}

另外,我在他们的网站上查了下,发现我不能使用低于 19.4.0 或 18.1.0 的版本(我不明白哪个是最低版本,但它们都不起作用)。

这是我在尝试使用其中一个版本时遇到的错误:

error: failed linking references.

而且我知道我的代码很好,因为我尝试使用版本:“play-services-ads 17.1.1”并且它有效,但仅适用于测试广告而不是真实广告,所以总而言之,我会想知道如何获取 Compile Sdk 版本 28 或更高版本以便在我的应用程序上展示广告。

此菜单显示您已安装的版本

所以要获得版本 28 或 29,您需要安装它

第一个选项是从 build.gradle 文件中更改它,例如

android
    compileSdkVersion 29
    defaultConfig {
        .....
        minSdkVersion 21
        targetSdkVersion 29
    }
   ....
}

或从 SDK 管理器 select 显示包详细信息并安装 Android SDK 平台 28 或 29 然后 select 从编译 SDK 版本菜单