Ошибка при попытке компиляции приложения Toga в APK файл
В общем осваиваю Toga и Beeware. решал запихнуть в apk файл telegram бот на aiogram. вот код.
import toga
from toga.style import Pack
from toga.constants import COLUMN, CENTER
from aiogram import Bot, Dispatcher, types
import asyncio
import nest_asyncio
class HelloWorld(toga.App):
def startup(self):
nest_asyncio.apply() # Применить патч nest_asyncio к текущему событийному циклу
main_box = toga.Box(style=Pack(direction=COLUMN, alignment=CENTER))
button = toga.Button(
"Start Bot",
on_press=self.start_bot,
style=Pack(padding=5, alignment=CENTER)
)
main_box.add(button)
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = main_box
self.main_window.show()
def start_bot(self, widget):
asyncio.create_task(self.run_bot())
async def run_bot(self):
bot = Bot(token='TOKEN')
dp = Dispatcher()
@dp.message()
async def on_text_message(msg: types.Message):
await msg.reply(f"You said: {msg.text}")
await dp.run_polling(bot)
def main():
return HelloWorld()
if __name__ == "__main__":
main().main_loop()
в терминал PyCharm вводил все что нужно по документации. поскольку я сперва сделал простое android приложение, без telegram бота то порядок был такой: briefcase new, cd helloworld, briefcase dev,briefcase create, briefcase build, briefcase run после легкого обновления кода briefcase run -u
затем собрал apk файл из кода под документации briefcase create android, briefcase build android, briefcase run android
все сработало. потом обновил код. импортировал aiogram. в файле pyproject.toml в requires = [] добавил "aiogram"
далее ввел briefcase run -u
для сборки briefcase create android, briefcase build android
и вот в процессе сборки после ввода briefcase build android все ломается.
ERROR: Failed to install pydantic-core==2.6.3 from https://files.pythonhosted.org/packages/cb/fe/8c9363389f8f303fb151895af83ac30e06c0406779fe188b4281a64e4c50/pydantic_core-2.6.3.tar.gz#sha256=1508f37ba9e3ddc0189e6ff4e2228bd2d3c3a4641cbe8c07177162f76ed696c7 (from pydantic<2.4,>=2.1.1->aiogram->-r requirements.txt (line 1)). For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues. Chaquopy: Exit status 1
Task :app:generateDebugPythonRequirements FAILED
FAILURE: Build failed with an exception.
Execution failed for task ':app:generateDebugPythonRequirements'.
Process 'command 'py'' finished with non-zero exit value 1
To view full details in Android Studio:
Click the 'Build: failed' caption to the left of this message.
Then scroll up to see the full output.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 36s 2 actionable tasks: 2 executed Building...
Error while building project.