应用程序在启动后立即崩溃并出现错误

App crashes with error immediately after launching

提问人:ASD 提问时间:7/11/2023 最后编辑:ASD 更新时间:7/12/2023 访问量:90

问:

Python、Kivy、Buildozer。

我正在使用 firebase admin,所以这里是日志:

Traceback (most recent call last):
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/app/main.py", line 33, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/google/cloud/firestore/__init__.py", line 18, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/google/cloud/firestore_v1/__init__.py", line 27, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/google/cloud/firestore_v1/_helpers.py", line 22, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/google/api_core/gapic_v1/__init__.py", line 16, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/google/api_core/gapic_v1/config.py", line 23, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/grpc/__init__.py", line 22, in <module>
    File "/mnt/c/Users/rEHui/Desktop/wsl/APP/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/emergencyApp/arm64-v8a/grpc/_compression.py", line 20, in <module>
ImportError: dlopen failed: "/data/data/org.test.emergencyapp/files/app/_python_bundle/site-packages/grpc/_cython/cygrpc.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)

buildozer.spec:

[app]

# (str) Title of your application
title = Emergency Application

# (str) Package name
package.name = emergencyApp

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,gif

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
#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)
version = 0.1

# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy==2.2.0 ,pyttsx3,googlemaps, bcrypt, kivymd==1.1.1, requests, openssl, urllib3, chardet, idna, jwt, cryptography, pyparsing, firebase_admin, PIL, google-auth, cachetools, pyasn1, pyasn1_modules, rsa, google-api-python-client, google-cloud-storage, google-cloud-firestore, google-api-core,  protobuf, cachecontrol, gcloud, google-cloud, httplib2, grpcio, google-cloud-core, proto-plus, google-cloud-translate

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (list) Supported orientations
# Valid options are: landscape, portrait, portrait-reverse or landscape-reverse
orientation = portrait

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 1.9.1

#
# Android specific
#

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0

# (string) Presplash background color (for android toolchain)
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
# olive, purple, silver, teal.
#android.presplash_color = #FFFFFF

# (string) Presplash animation using Lottie format.
# see https://lottiefiles.com/ for examples and https://airbnb.design/lottie/
# for general documentation.
# Lottie files can be created using various tools, like Adobe After Effect or Synfig.
#android.presplash_lottie = "path/to/lottie/file.json"

# (str) Adaptive icon of the application (used if Android API level is 26+ at runtime)
#icon.adaptive_foreground.filename = %(source.dir)s/data/icon_fg.png
#icon.adaptive_background.filename = %(source.dir)s/data/icon_bg.png

# (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)

# (list) features (adds uses-feature -tags to manifest)
#android.features = android.hardware.usb.host

# (int) Target Android API, should be as high as possible.
android.api = 33

我之前所做的是收到像google.type模块丢失这样的错误,或者像这个谷歌这样的错误。(模块) 未找到,

所以我从我的目录中添加了一个 Google 文件夹到 WSL 的目录:

C:\Users\rEHui\Desktop\wsl\APP\.buildozer\android\platform\build-arm64-v8a_armeabi-v7a\build\python-installs\emergencyApp\(arm64-v8a and armeabi-v7a)\google

然后我转到 google 文件夹中的每个目录并添加缺少的模块

之后,应用程序显示另一个错误:导入 main.py:

import googlemaps
from keys.Key import map_api_key, email_secret
import os
import firebase_admin
from firebase_admin import credentials
from google.cloud import firestore
from firebase_admin import firestore
import re
import pyttsx3
import datetime
import smtplib
import string
import random
import bcrypt as bcrypt

尝试过这个,如前所述不起作用:Kivy buildozer Firestore 错误 - ModuleNotFoundError:没有名为“google.cloud”的模块

编辑: 我理解了很多事情,所以我之前提到的问题的 cu,它的 stiil “火力基地”但不是它。缺少的库是 grpc(gRPC),您需要制作一个自定义配方才能使其工作。 这里的食谱是什么:

官方文档

Github 说明

我不知道它是如何工作的以及如何使用它的食谱:

食谱示例

python firebase kivy firebase-admin buildozer

评论

2赞 VoNWooDSoN 7/11/2023
它看起来非常像 cython / grpc“共享对象”(.so) 文件是为 x86 处理器编译的,但您正在尝试将其与 ARM 架构的计算机一起使用。我建议您在安装 google cloud 软件包之前使用您的包管理器安装 ARM cython 依赖项。

答: 暂无答案