Skip to content

Commit

Permalink
Add android.add_assets (#1382)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertFlatt authored Nov 29, 2021
1 parent 7cffb89 commit 028adb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions buildozer/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ source.include_exts = py,png,jpg,kv,atlas
#source.exclude_dirs = tests, bin, venv

# (list) List of exclusions using pattern matching
# Do not prefix with './'
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
Expand Down Expand Up @@ -179,6 +180,12 @@ fullscreen = 0
# (list) Android AAR archives to add
#android.add_aars =

# (list) Put these files or directories in the apk assets directory.
# Either form may be used, and assets need not be in 'source.include_exts'.
# 1) android.add_assets = source_asset_relative_path
# 2) android.add_assets = source_asset_path:destination_asset_relative_path
#android.add_assets =

# (list) Gradle dependencies to add
#android.gradle_dependencies =

Expand Down
11 changes: 11 additions & 0 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,17 @@ def execute_build_package(self, build_cmd):
cmd.append('--add-aar')
cmd.append(realpath(expanduser(aar)))

# support for assets folder
assets = self.buildozer.config.getlist('app', 'android.add_assets', [])
for asset in assets:
cmd.append('--add-asset')
if ':' in asset:
asset_src, asset_dest = asset.split(":")
else:
asset_src = asset
asset_dest = asset
cmd.append(realpath(expanduser(asset_src)) + ':' + asset_dest)

# support for uses-lib
uses_library = self.buildozer.config.getlist(
'app', 'android.uses_library', '')
Expand Down

0 comments on commit 028adb1

Please sign in to comment.