chiark / gitweb /
apps with no <uses-sdk> get strange values of minSdkVersion
authorHans-Christoph Steiner <hans@eds.org>
Tue, 3 Jun 2014 17:28:35 +0000 (13:28 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 5 Jun 2014 02:01:25 +0000 (22:01 -0400)
Using this example app which does not have <uses-sdk>:
https://android.googlesource.com/platform/development/+log/master/samples/ApiDemos/assets/HelloActivity.apk

aapt then returns "sdkVersion:'IceCreamSandwich'".  minSdkVersion is only
ever supposed to be an integer, so this is a bizarre APK.  It is included
only as a binary in the git repo for Android sample code.  But who knows
what else is out there, so report and error and carry on with the update
process.

fdroidserver/update.py

index 839a84f8c61772e17843508d1c5ff14ba66bf9c7..aca6b994f4e112fc6055d621f0153a4fa2509a00 100644 (file)
@@ -419,7 +419,12 @@ def scan_apks(apps, apkcache, repodir, knownapks):
                         path = match.group(2)
                         thisinfo['icons_src'][density] = path
                 elif line.startswith("sdkVersion:"):
-                    thisinfo['sdkversion'] = re.match(sdkversion_pat, line).group(1)
+                    m = re.match(sdkversion_pat, line)
+                    if m is None:
+                        logging.error(line.replace('sdkVersion:', '')
+                                      + ' is not a valid minSdkVersion!')
+                    else:
+                        thisinfo['sdkversion'] = m.group(1)
                 elif line.startswith("maxSdkVersion:"):
                     thisinfo['maxsdkversion'] = re.match(sdkversion_pat, line).group(1)
                 elif line.startswith("native-code:"):