简体   繁体   English

如何使用 Kivy 和 buildozer 在 android 中使用 nltk

[英]How to use nltk in android using Kivy and buildozer

I need to test NLTK program in android with Kivy.我需要使用 Kivy 在 android 中测试 NLTK 程序。 But app crashes when I open the app.但是当我打开应用程序时,应用程序崩溃了。 Program has no errors.程序没有错误。 I tried modifying the buildozer.spec file(added nltk in kivy requirements) but it didn't workout.我尝试修改 buildozer.spec 文件(在 kivy 要求中添加了 nltk),但没有成功。 How to make it work?如何让它发挥作用?

Here is the "app" section of buildozer.spec file这是 buildozer.spec 文件的“app”部分

[app]

# (str) Title of your application
title = NLTK APP

# (str) Package name
package.name = nltkapp

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

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

# (list) List of exclusions using pattern matching
#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 seperated e.g. requirements = sqlite3,kivy
requirements = kivy, android, nltk

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

# (list) Garden requirements
#garden_requirements =

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

# (str) Supported orientation (one of landscape, portrait or all)
orientation = portrait

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

So this was so long for you I doubt you care anymore but I'm encountering the same issue and here is how far I've gotten...所以这对你来说太久了我怀疑你不再关心但我遇到了同样的问题这是我已经走了多远......

You need to add more dependencies to your您需要为您的添加更多依赖项

# (list) Application requirements
requirements = python2,kivy,goslate,chardet,idna,nltk

I think if you add those your App will at least start... but honestly the best thing I've found from others that has helped me debug is using 'adb logcat' command in your terminal.我想如果你添加那些你的应用程序至少会启动......但老实说,我从其他人那里发现的帮助我调试的最好的东西是在你的终端中使用'adb logcat'命令。

  1. Goto your phones developer mode and make sure it's 'USB debugging connected' is turned on.转到您的手机开发人员模式并确保它的“USB 调试连接”已打开。
  2. Plug your phone into your computer and in a CMD line type: adb logcat将手机插入计算机并在 CMD 行中输入:adb logcat
  3. Lot's of stuff is going to pop up, wait a little till it settles.很多东西会弹出,稍等一下,直到它稳定下来。 This is more or less spitting out everything your phone is doing.这或多或少会吐出你手机正在做的一切。
  4. Try running your App and check out the error msg it gives you.尝试运行您的应用程序并检查它给您的错误消息。 That is the most valuable debugging you'll get since typically App crashes don't display any error msg.这是您将获得的最有价值的调试,因为通常应用程序崩溃不会显示任何错误消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM