I have the following line in my manifest:
<intent-filter android:autoVerify="true">
but I get a lint warning:
Attribute autoVerify is only used in API 23 and higher (current min is 16)
so I changed it to look like this (as per the recommendation that android studio gives me):
<intent-filter android:autoVerify="true" tools:targetApi="M">
and I then receive this error when building the apk:
Error:java.lang.RuntimeException: [path_to_manifest]/AndroidManifest.xml:58:13-67:29: Error: Invalid instruction 'targetApi', valid instructions are : REMOVE,REPLACE,STRICT
Caused by: java.lang.IllegalArgumentException: No enum constant com.android.manifmerger.AttributeOperationType.TARGETAPI
How can I get rid of this error while still getting rid of the lint warning?
Edit: I tried both "clean project" and "invalidate cache and restart" - neither work to solve the error.
Issue opened on the Issue Tracker:
https://code.google.com/p/android/issues/detail?id=211805
I found an answer here the gives a workaround for this issue.
By using the line:
<intent-filter android:autoVerify="true"
tools:ignore="UnusedAttribute">
The lint error is solved and the apk can be built. I'm not going to mark this as the accepted answer though - I prefer if someone can explain how targetApi can be used (if it can be used)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With