Home » Android » android – Kivy and Google Play services

android – Kivy and Google Play services

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m trying one approach of implementing ads into Kivy app using this example

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

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!

EDIT: 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

but still get an error:

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

here is this line:

    <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!!!
How to&Answers:

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.

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)

Answer:

I ran into a similar problem when adding google-play-services_lib to my kivy project.

I listed the available targets like so:

  % ~/.buildozer/android/platform/android-sdk-21/tools/android list targets
Available Android targets:
----------
id: 1 or "android-14"
     Name: Android 4.0
     Type: Platform
     API level: 14
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
 Tag/ABIs : no ABIs.

And then I updated the library using:

  % cd ~/myproject/libs/android/google-play-services_lib
  % ~/.buildozer/android/platform/android-sdk-21/tools/android update project -p . -t android-14
Updated project.properties
Updated local.properties
Updated file ./proguard-project.txt

and could then successfully build the package.