首页 > 代码库 > Android - 警告:it is always overridden by the value specified in the Gradle build script

Android - 警告:it is always overridden by the value specified in the Gradle build script

警告:it is always overridden by the value specified in the Gradle build script


本文地址: http://blog.csdn.net/caroline_wendy


警告:This minSdkVersion value (8) is not used; it is always overridden by the value specified in the Gradle build script (8) (at line 9)

AndroidManifest.xml:
    <uses-sdk android:minSdkVersion="8"
        android:targetSdkVersion="20" />


build.gradle:
    defaultConfig {
        // 目标SDK以及所支持的最小的SDK版本
        minSdkVersion 8
        targetSdkVersion 18
    }


原因:
AndroidManifest.xml和build.gradle的minSdkVersion和targetSdkVersion重复或冲突;
gradle会重写manifest的值,使用时,应该优先更新gradle的SdkVersion

解决方式:
AndroidManifest.xml使用<uses-sdk></uses-sdk>安全移除SdkVersion,就可以解决问题;
    <uses-sdk>
        android:minSdkVersion="8"
        android:targetSdkVersion="20"
   </uses-sdk>









Android - 警告:it is always overridden by the value specified in the Gradle build script