【问题标题】:Android Studio - uses-sdk:minSdkVersion 7 cannot be smaller than version 9 declared in libraryAndroid Studio - uses-sdk:minSdkVersion 7 不能小于库中声明的版本 9
【发布时间】:2016-05-10 16:52:04
【问题描述】:

到目前为止,我的应用程序中有android:minSdkVersion="7"。后来我不得不添加需要minSdkVersion="9" 的谷歌播放服务。我得到了这个错误:

uses-sdk:minSdkVersion 7 cannot be smaller than version 9 declared in library
[com.google.android.gms:play-services:8.4.0] C:\AppsFolder\MyApp\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\AndroidManifest.xml

我并不介意设置更高的 minSdk,所以我将其更改为 android:minSdkVersion="9"

但我仍然遇到同样的错误...我多次清理和重建项目,但这种情况一直在发生。不知何故,Android Studio 仍然在某处看到android:minSdkVersion="7"。任何想法如何解决这个问题?

我使用的是 Android Studio 1.5.1

【问题讨论】:

  • 请显示您所有的应用程序 gradle 文件

标签: android-studio google-play-services android-manifest android-min-sdk


【解决方案1】:

看来您是直接在AndroidManifest.xml 文件中更改minSdkVersion。 Android Studio 对这些设置使用 gradle 文件,而不是清单文件。

您应该从清单中删除这些条目并编辑您的应用程序build.gradle 文件(位于您的项目根/app/ 文件夹中)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.yourdomain.yourpackage"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-14
    • 2021-04-10
    • 1970-01-01
    • 1970-01-01
    • 2018-01-22
    • 2021-05-15
    • 2021-03-14
    • 2017-12-18
    相关资源
    最近更新 更多