Skip to content

Fix ANDROIDAPI #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@ def make_package(args):
'GAME or APP')
sys.exit(-1)

# Get target android API
android_api = int(os.environ.get('ANDROIDAPI', '8'))

# Render the various templates into control files.
render(
'AndroidManifest.tmpl.xml',
Expand All @@ -278,7 +275,7 @@ def make_package(args):
url_scheme=url_scheme,
intent_filters=intent_filters,
manifest_extra=manifest_extra,
android_api=android_api)
)

render(
'Configuration.tmpl.java',
Expand All @@ -302,7 +299,7 @@ def make_package(args):
# Update the project to a recent version.
try:
subprocess.call([ANDROID, 'update', 'project', '-p', '.', '-t',
'android-{}'.format(android_api)])
'android-{}'.format(args.sdk_version)])
except (OSError, IOError):
print 'An error occured while calling', ANDROID, 'update'
print 'Your PATH must include android tools.'
Expand Down Expand Up @@ -360,6 +357,9 @@ def make_package(args):
if __name__ == '__main__':
import argparse

# get default SDK version from environment
android_api = os.environ.get('ANDROIDAPI', 8)

ap = argparse.ArgumentParser(description='''\
Package a Python application for Android.

Expand Down Expand Up @@ -437,9 +437,9 @@ def make_package(args):
default=join(curdir, 'whitelist.txt'),
help=('Use a whitelist file to prevent blacklisting of '
'file in the final APK'))
ap.add_argument('--sdk', dest='sdk_version', default='8',
ap.add_argument('--sdk', dest='sdk_version', default=android_api,
help='Android SDK version to use. Default to 8')
ap.add_argument('--minsdk', dest='min_sdk_version', default='8',
ap.add_argument('--minsdk', dest='min_sdk_version', default=android_api,
help='Minimum Android SDK version to use. Default to 8')
ap.add_argument('--window', dest='window', action='store_true',
help='Indicate if the application will be windowed')
Expand Down
4 changes: 2 additions & 2 deletions src/templates/AndroidManifest.tmpl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
{% if android_api >= 9 %}
{% if args.min_sdk_version >= 9 %}
android:xlargeScreens="true"
{% endif %}
/>
Expand All @@ -29,7 +29,7 @@

<activity android:name="org.renpy.android.PythonActivity"
android:label="@string/iconName"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode{% if android_api >= 13 %}|screenSize{% endif %}"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode{% if args.min_sdk_version >= 13 %}|screenSize{% endif %}"
android:launchMode="singleTask"
android:process=":python"
android:screenOrientation="{{ args.orientation }}"
Expand Down