Issue
I need to have a different minSDKVersion in the Google Play Store (for device filtering purposes) than for private beta testing. I tried the following:
AndroidManifest.xml contains the following:
<manifest …>
[…]
<uses-sdk android:minSdkVersion="@integer/minSdkVersion" android:targetSdkVersion="15"/>
[…]
</manifest>
res/values/config.xml is generated by maven and contains the following:
<resources>
<integer name="minSdkVersion">8</integer>
</resources>
This works fine except for aapt dump badging which complains:
ERROR getting 'android:minSdkVersion' attribute: attribute is not a string value
Unfortunately aapt dump does not dump the rest. So I am left with no output except this error :-(
When I change the minSdkVersion reference to a string reference like this:
AndroidManifest.xml contains the following:
<manifest …>
[…]
<uses-sdk android:minSdkVersion="@string/minSdkVersion" android:targetSdkVersion="15"/>
[…]
</manifest>
res/values/config.xml is generated by maven and contains the following: 8
With this I cannot install the app because somehow my device with API Level 16 (Jelly Bean) does not allow APKs with
sdkVersion:'8'
(according to aapt dump badging) to be installed. The error is: INSTALL_FAILED_OLDER_SDK
It seems the string reference is somehow misinterpreted while creating the APK.
What can I do to have android:minSdkVersion referenced from a resource-file and debug it with aapt?
aapt version is 0.2 from Android Tools Rev. 20.
Solution
Since I am already using Maven to build the project I solved the problem this way:
I moved the AndroidManifest.xml to a folder called: ${project.basedir}/filtered and replaced the minSdkVersion value in the AndroidManifest.xml with a property reference (I already had this in the pom.xml): ${project.property.minSdkVersion}:
<uses-sdk android:minSdkVersion="${project.property.minSdkVersion}" android:targetSdkVersion="15"/>
and removed it from the filtered/config.xml. Then I added the following resource-filtering directive to the pom.xml:
<project ...>
...
<properties>
<project.property.minSdkVersion>8</project.property.minSdkVersion>
</properties>
...
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>${project.basedir}/filtered</directory>
<targetPath>${project.basedir}/</targetPath>
<includes>
<include>AndroidManifest.xml</include>
</includes>
</resource>
</resources>
...
</build>
...
</project>
This way the filtered AndroidManifest.xml is at the place where Eclipse expects it and has the property reference replaced after calling mvn process-resources. In the other profiles I have different values for ${project.property.minSdkVersion}
Answered By - Dirk Jäckel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.