How do I use tools:overrideLibrary in a build.gradle file?

前端 未结 9 1784
慢半拍i
慢半拍i 2020-11-28 18:00

I\'m using the leanback libraries, which require Android 17 or later. However my app supports a minSDK of 16, so I get a build error from gradle saying

Erro         


        
相关标签:
9条回答
  • 2020-11-28 18:37
    <manifest xmlns:tools="http://schemas.android.com/tools" ... >
      <uses-sdk tools:overrideLibrary="nl.innovalor.ocr, nl.innovalor.corelib" />
    

    I was facing the issue of conflict between different min sdk versions. So this solution worked for me.

    0 讨论(0)
  • 2020-11-28 18:38

    it doesn't matter that you declare your minSdk in build.gradle. You have to copy overrideLibrary in your AndroidManifest.xml, as documented here.

    <manifest 
        ... >
    <uses-sdk tools:overrideLibrary="com.example.lib1, com.example.lib2"/>
        ...
    </manifest>
    

    The system automatically ignores the sdkVersion declared in AndroidManifest.xml.

    I hope this solve your problem.

    0 讨论(0)
  • 2020-11-28 18:39

    Open Android Studio -> Open Manifest File

    add <uses-sdk tools:overrideLibrary="android.support.v17.leanback"/> don't forget to include xmlns:tools="http://schemas.android.com/tools" too, before the <application> tag

    enter image description here

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