Android Studio - Can't specify own minSdkVersion

后端 未结 3 1834
栀梦
栀梦 2021-01-18 18:00

After installing the Android L Developer Preview SDK earlier today I wanted to make my app compatible with both Android L and older versions such as Jelly Bean. My app uses

相关标签:
3条回答
  • 2021-01-18 18:07

    You are using this dependency:

    compile "com.android.support:support-v4:+"
    

    In this way you are using the support-v4 in L-preview (21-rc1).

    This support lib is declaring minSdkVersion L (you can check the Manifest).

    You have to force the minSdkVersion to be 'L' (check the doc: http://developer.android.com/preview/setup-sdk.html)

    On the development environment, open the build.gradle file for your module and make sure that:

    compileSdkVersion is set to 'android-L'
    minSdkVersion is set to 'L'
    targetSdkVersion is set to 'L'
    

    It is not a bug, but this is because these APIs are not final. It is a way to prevent installing the apps on a final API 21 device or publishing it on the store using support lib 21-r1.

    0 讨论(0)
  • 2021-01-18 18:12

    In developer documentation says (http://developer.android.com/preview/setup-sdk.html):

    On the development environment, open the build.gradle file for your module and make sure that:

    • compileSdkVersion is set to 'android-L'
    • minSdkVersion is set to 'L'
    • targetSdkVersion is set to 'L'

    It seems that can't be backward compatible (right now).

    0 讨论(0)
  • 2021-01-18 18:21

    See my post to /r/AndroidDev here that provides a workaround.

    0 讨论(0)
提交回复
热议问题