Skip to content
Commit 1966e1f2 authored by Ryan Mitchell's avatar Ryan Mitchell
Browse files

AAPT2: Only print last uses-sdk tag

When an APK defines multiple "uses-sdk" tags, the Android runtime only
uses the minSdkVersion and targetSdkVersion values from the last
occurrence of the "uses-sdk" tag.

For example an application with the following tags:
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
<uses-sdk android:maxSdkVersion="28"/>

Will have the following version codes at runtime:
minSdk=1 targetSdk=1

Another example:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>

Will have the following version codes at runtime:
minSdk=5 targetSdk=19

AAPT2 must print the version data from only the last tag, skipping other
occurrences of the tag.

Bug: 175789289
Test: manual
Change-Id: If0fece7de1d96046221c89d1b12515bc5c15c301
parent ff68a9ad
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment