Hello
Can someone please take a look over these steps and see if there's anything glaringly obvious that I've done wrong?
The apk builds without errors in Android studio but the app crashes on device (it's just a blank hello world type app).
Thanks!
EDIT: Solved, and these steps now do the job:
Here's how I get Admob ads on my Android app:DO ON PC if possible as Mac does weird things when copying folders.1) Download plugins from Gideros github
2) Export project from Gideros (to Eclipse)
2a) Move gideros.jar to libs
2a) If you’re making a Gideros player, delete the assets folder within [exported project]/assets/
3) Go into the Gideros plugins folder
4) Then /ads/source/Android
5) Copy folders: libs and src to [exported project] folder
6) For admob, Go into libs and delete everything except:
armeabi/
armeabi-v7a/
x86/
gideros.jar
7) Go into src and click through to frameworks/
8) Delete everything except AdsAdmob.java
9) Open your main java activity file ([exported project]/src/com/giderosmobile/android/projectName.java
10) UNDER under System.loadLibrary("gideros");
Add:
System.loadLibrary("ads");
11) In the same file add this function, replace
static private String[] externalClasses = {
};
with:
static private String[] externalClasses = {
"com.giderosmobile.android.plugins.ads.Ads",
};
12) Open AndroidManifest.xml in [exported project]/app/src/main
13) To the list of permission tags, add:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
14) Add this to the application tag
<!-- google play -->
<meta-data android:name="com.google.android.gms.version" android:value="<a href="https://forum.giderosmobile.com/profile/integer%2Fgoogle_play_services_version%26quot" rel="nofollow">@integer/google_play_services_version"</a>; />
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> |
Make sure each tag takes up one line and isn't broken by a line break. This can cause errors when building the app later.
15) Open your exported project in Android Studio
16) Add the dependency for google play services to your project:
» File
» project structure
» app
» dependencies
» click on +
» library dependency
» select play-services (Something like: com.google.android.gms:play-services:7.5.0)
17) In the Gradle Scripts drop down, look for build gradle:app
Set these values
- minSdkVersion 9 (might change over time - can't be lower than whatever is in google play services)
- compileSdkVersion 22
- targetSdkVersion 22
Comments
Here's the output from logcat
5) Copy folders: libs and src to [exported project]/app/
Try to find this lib thorough file tree in android studio.
btw, What device do you use?
http://giderosmobile.com/forum/discussion/comment/43090#Comment_43090
Likes: Tom2012
The crash I have is now:
Thanks!
Try to use alerts on ads events. Like AD_FAILED and AD_RECEIVED. With second option of your code.
Likes: Tom2012
What I was doing wrong was using run straight in Android Studio.
Once I made my own Gideros Player, and then launched from Gideros Studio, I could see the ad.
So the big question is - why can't you 'run' your app from Android Studio / Eclipse and see the ads in place. Why does it only work when you first create a player, and then test from Gideros?
Thanks again for the help guys.
Likes: Tom2012
You're quite right. It's running fine now as a player or as the actual app.
EDIT: I've updated my list of steps in the original post in case anyone else is struggling to do this.