简体   繁体   English

Android Studio创建的build.gradle中minSDK的实现过高

[英]too high implementation for minSDK in build.gradle created by Android Studio

I've just created my first Android Studio project. 我刚刚创建了我的第一个Android Studio项目。 I chose min SDK 15 . 我选择了最小SDK 15 I'm worried why then compile SDK by default is higher .. Is it secure? 我担心为什么默认情况下编译SDK 会更高 ..它安全吗? Will my app run on devices with API 15 in this configuration? 我的应用程序可以在此配置中使用API​​ 15的设备上运行吗? But the real problem occurred when I switched my compileSdkVersion and targetSdkVersion to 24. Errors everywhere and info that implementation 'com.android.support:appcompat-v7:26.1.0' is too high for my target SDK. 但是,当我将compileSdkVersion和targetSdkVersion切换为24时,发生了真正的问题。到处都是错误,并且信息implementation 'com.android.support:appcompat-v7:26.1.0'的实现对于我的目标SDK来说过高。 So why on earth Android Studio put there so high implementation if the min SDK is lower ? 那么,如果最低SDK 较低,为什么在Android Studio上实施如此高的实现呢?

TL;DR: Why implementation is so high? TL; DR:为什么实施如此之高? Will it work in this configuration with min API?? 使用min API在这种配置下可以使用吗? Why Android Studio works like this? 为什么Android Studio会这样工作?

build.gradle: build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.q_back.audiocrator"
        minSdkVersion 15
        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'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

Its ok, and in fact normal for the compileSDK to be bigger than the minimum. 没关系,实际上compileSDK大于最小值是正常的。 The library version for the support version should match your compileSDK. 支持版本的库版本应与您的compileSDK相匹配。 Either upgrade to 26, or downgrade the support library. 升级到26,或降级支持库。

All android devices with SDK versions equal and above the minSDKVersion will be able to run the application. 所有SDK版本等于或高于minSDKVersion的android设备都可以运行该应用程序。 it is best to use the same version of SDK tools as the version on your compileSDK, it won't really affect the devices that can run the applications. 最好使用与compileSDK上相同版本的SDK工具,这不会真正影响可以运行应用程序的设备。 the major factor is that some Google APIs wont work on lower SDK levels. 主要因素是某些Google API无法在较低的SDK级别上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM