Is it possible for manifest properties to change based on Android SDK versions?
eg: have android:largeHeap
be true
when SDK version < 24 and false
when SDK >= 24?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Try This
res/values/bool.xml
<resources>
<bool name="largeheap">true</bool>
</resources>
res/values-v24/bool.xml
<resources>
<bool name="largeheap">false</bool>
</resources>
Android Manifest file:
<application
android:largeHeap="@bool/largeheap"
android:allowBackup="true"
android:icon="@drawable/ic_launcher">
....
</application>
Make true
in res/values/bool.xml
and false
in res/values-v24/bool.xml
. Android API Level 24, so -v24
will be used for 24 and higher versions.
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