【发布时间】:2018-02-20 12:31:03
【问题描述】:
我正在使用 python 2.7.12、buildozer 0.34、cython 0.25.2 和 kivy 1.10.0。我打算使用 KivMob 在我的应用上展示广告。我已经有了我的测试设备 ID 和 APP_ID。我从KivMob 尝试了这段代码。
from kivmob import KivMob
from kivy.app import App
from kivy.uix.button import Button
class KivMobTest(App):
def build(self):
ads = KivMob("ca-app-pub-APP_ID")
ads.add_test_device("TEST_DEVICE_ID")
ads.new_interstitial("ca-app-pub-INTERSTITIAL_ID")
ads.request_interstitial()
return Button(text='Show Interstitial',
on_release= lambda a:ads.show_interstitial())
并在 buildozer.spec 中写了这个:
requirements = kivy, hostpython2, android, kivmob
android.permissions = INTERNET, ACCESS_NETWORK_STATE
p4a.source_dir = /python-for-android-admob/
p4a.bootstrap = sdl2-admob
但是当我运行命令“buildozer -v android debug”时,它给出了一个错误:
kivy/core/window/window_x11.pyx:221:13: 'WindowInfoX11' is not a type identifier
STDERR:
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2-admob --requirements=kivy,hostpython2,android,kivmob --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/ken/testads/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
我尝试构建一个简单的 hello world 按钮应用程序,它使用与上述相同版本的 python、buildozer、cython 和 kivy。并使用了python-for-android-master。
p4a.source_dir = /python-for-android-master/
简单的hello world按钮应用就创建成功了。
我真的很想在我的应用上展示广告。我将不胜感激任何帮助。谢谢。
【问题讨论】: