Reputation: 69
Trying to make an android native extension (ane) with an AdMob banner for my AIR project.
Problem is, when i run the final apk on my phone, Eclipse DDMS gives me an error:
Could not find class 'com.google.android.gms.ads.AdView' referenced from method blah blah
And the AdMob banner does not appear.
Looks like google play services somehow are not included, or not accessible.
I know my extension is working, because i can add a native android text or a button on top of my AIR project and they appear on the phone, but AdMob banner does not.
Also if i make apk with only android (no AIR), the banner appears just fine.
I am using JDK 1.8 Google Play Services rev 24 Android SDK Tools rev 24.2 target=android-22 Eclipse 4.4.2
Been trying to solve this for a week, nothing i tried helped.
Whatever you'll suggest, i will try it.
Upvotes: 0
Views: 289
Reputation: 69
The problem was I wasn't building the .ane file right.
This blog helped me and I got it working:
http://jmsliu.com/2143/add-admob-ads-in-flash-based-android-apps.html
Specifically, i had no idea i had to include:
google-play-services-res: this folder contains all resource required by google play service lib. It is copied from google play services lib. You can get all this from Android SDK)
android-support-v4.jar: this java library is copied from google play services lib
google-play-services.jar: this java library is copied from google play services lib
through platform options xml file:
<platform xmlns="http://ns.adobe.com/air/extension/4.0">
<packagedDependencies>
<packagedDependency>android-support-v4.jar</packagedDependency>
<packagedDependency>google-play-services.jar</packagedDependency>
</packagedDependencies>
<packagedResources>
<packagedResource>
<packageName>com.google.android.gms</packageName>
<folderName>google-play-services-res</folderName>
</packagedResource>
</packagedResources>
</platform>
Somehow I was thinking that users already have google play services on they Android phones and there is no need to include all those libraries and resources. Still don't understand why they are needed. Apparently, you need both: 1. to include gogle play services libs and resources; 2. users to have google play services installed on their phones.
Upvotes: 1