LoginSignup
2
0

BuildozerファイルをカスタマイズしてAndroidアプリのアイコンを変える。

Posted at

はじめに

 Python+Kivy+BuildozerでAndroidアプリを作ることができる。ただ、Buildozerをデフォルト設定でビルドするとアイコンがKivyのマークになる。この記事では、自作のアイコンへ変更する方法についてまとめる。

image.png

PythonでAndroidアプリを作る方法は下記参照。

Buildozer.specをカスタマイズしてアイコン変更

 アイコン含めBuildozerの設定は、buildozer initで生成されるbuildozer.specファイルを変更することでできる。アイコン変更はicon.filnameを有効にすればOK。
 %(source.dir)s/がbuildozer.specと同ディレクトリを指すので、そこにicon.pngファイルを格納した状態でビルド(buildozer -v android debug)すれば、icon.pngの画像がAndroidアプリのアイコンになる。アイコン画像は512x512のpngファイルにする。

buildozer.spec
# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png
#変更後
icon.filename = %(source.dir)s/icon.png

アイコン作成で透過させるアプリは peko step が便利でした。

その他カスタマイズ

アイコン以外も下記の変更が可能。

buildozer.spec
#アプリ名---------------------------
# (str) Title of your application
#title = My Application
title = Color_bar

#apkパッケージ名--------------------
# (str) Package name
package.name = color_bar

#importするライブラリ列挙-----------
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy 

#ネット有効-------------------------
# (list) Permissions
# (See https://python-for-android.readthedocs.io/en/latest/buildoptions/#build-options-1 for all the supported syntaxes and properties)
android.permissions = android.permission.INTERNET, (name=android.permission.WRITE_EXTERNAL_STORAGE;maxSdkVersion=18)
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0