Kivy 和 Google Play 服务

时间:2023-03-21
本文介绍了Kivy 和 Google Play 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试使用此 示例

我不知道它是否会起作用.我在SDK中下载了Google Play服务,但我不知道我必须将它粘贴到哪里,我尝试了很多地方,但都不成功,总是得到

I have no idea if its going to work. I downloaded Google Play services in SDK, but I have no clue where I have to stick it into, I tried many places, but unsuccessfully, always get

error: package com.google.android.gms.ads.AdView does not exist

以及其他软件包.我为我对 android sdk 的无知而道歉,但我正在努力更好地理解它,所以我需要一些帮助.我需要知道我必须把google-play-services_lib"放在哪里,这样它才能找到它.谢谢!

and other packages as well. I apologize for my ignorance of android sdk, but I'm trying to understand it better, so I need some help. I need to know where I have to put 'google-play-services_lib' so it would find it. Thanks!

解决它,将其添加到buildozer.spec":

solved it, adding this to 'buildozer.spec':

# (list) Android library project to add (will be added in the
# project.properties automatically.)
android.library_references = libs/google-play-services_lib

但还是报错:

.../android-sdk-21/tools/ant/build.xml:539: Unable to resolve project target 'android-9'

这是这一行:

    <gettarget
            androidJarFileOut="project.target.android.jar"
            androidAidlFileOut="project.target.framework.aidl"
            bootClassPathOut="project.target.class.path"
            targetApiOut="project.target.apilevel"
            minSdkVersionOut="project.minSdkVersion" /> # line 539!!!

推荐答案

这也解决了,抱歉我在这里弄得一团糟,问和回答我自己的问题,但我认为这对 Kivy 用户来说是一个重要的话题,网上也没有太多关于这个的.所以,解决方案:我在google-play-services_lib"内的ant.properties"文件中手动将项目目标"设置为android-14".它抛出错误,因为 google play 服务库是针对较新的 android api 的.

And that solved as well, sorry for the mess I've made here, asking and answering my own questions, but I think it's an important topic for Kivy users, and there's not much about this on the net. So, solution: I manually set project 'target' to 'android-14' in 'ant.properties' file inside 'google-play-services_lib'. It was throwing error because the google play services library was for newer android api.

无论如何,对于任何好奇这是否有效(在 Android 的 Kivy 应用程序中实现广告)的人,是的,它有效,但我不得不重写原始解决方案以支持新库(使用 本指南)

Anyway, for anyone curious if that worked (implementing ads into Kivy app for Android), YES it worked, I had to rewrite the original solution to support new library though (using this guide)

这篇关于Kivy 和 Google Play 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:Buildozer 执行最后一条命令失败 下一篇:Kivy 中的 HTTPS 请求

相关文章