[英]Override maxSdkVersion used by library
Here's the scenario.这是场景。 My app (A) is using a library (B).
我的应用程序 (A) 正在使用库 (B)。
My app (A) is using permission READ_PHONE_STATE and it's declared in manifest.xml as我的应用程序 (A) 正在使用权限 READ_PHONE_STATE 并且它在 manifest.xml 中声明为
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
While library (B) is also using the same permission READ_PHONE_STATE, but with maxSdkVersion set to 22.虽然库 (B) 也使用相同的权限 READ_PHONE_STATE,但 maxSdkVersion 设置为 22。
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
android:maxSdkVersion="22"/>
So now the problem is when app is built and in the final _merged_manifest_ I'm having maxSdkVersion="22" set, and because of this my current device which is running nougat can't request for this particular permission.所以现在的问题是在构建应用程序时,在最终 _merged_manifest_ 我设置了maxSdkVersion="22" ,因此我当前运行 nougat 的设备无法请求此特定权限。
Currently I found a solution to override this value in my app (A) manifest.xml目前我找到了一个解决方案来覆盖我的应用程序 (A) manifest.xml 中的这个值
<uses-permission
tools:replace="android:maxSdkVersion"
android:name="android.permission.READ_PHONE_STATE"
android:maxSdkVersion="28"/>
But this requires me to update maxSdkVersion every time I update the sdk version in my app (A).但这需要我每次更新应用程序中的 sdk 版本时更新maxSdkVersion (A)。
So my question is所以我的问题是
Use tools:remove
attribute on your own AndroidManifest.xml
:在您自己的
AndroidManifest.xml
上使用tools:remove
属性:
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:remove="android:maxSdkVersion"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.