My project contains activity declarations in the manifest that use the tools:targetApi
attribute to ignore some warnings. Specifically:
<activity
android:name=".activities.ProtocolActivity"
android:label="@string/title_activity_protocols"
android:parentActivityName=".activities.InformationActivity"
tools:targetApi="jelly_bean">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.InformationActivity" />
</activity>
Out of the blue, however, for instance after switching branches, I get the following compilation error:
Error:/home/paul/git/ally-v2-app/app/src/main/AndroidManifest.xml:67:9-80:20: Error: Invalid instruction 'targetApi', valid instructions are : REMOVE,REPLACE,STRICT
...
Error:java.lang.IllegalArgumentException: No enum constant com.android.manifmerger.AttributeOperationType.TARGETAPI
I'm using the following:
It seems I can get things working again by clearing the cache and restarting Android Studio, or removing the attributes, building, then adding them again.
Replacing it by
tools:ignore="UnusedAttribute"
also fixes the lint issue.
Remove the targetApi
tag:
tools:targetApi="jelly_bean"
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