Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup admob on IntelliJ Idea?

It may sound that this question is a duplicate of:

How to properly configure AdMob using IntelliJ IDEA?

But it isn't! (Specially because that question is from 2011, and the google-process changed (As it seems)). I'm following this google-reference for proper setup.

First of all, there's the "Using Android Studio" option, and I have no idea of what that is. Then, I went to the next one: "Using Eclipse or another IDE", then there is a note, that was pretty straight-foward.

I've selected my project on IntelliJ Idea, pressed F4 (Open Module Settings) and went to SDKs in Platform Settings and just added the folder they asked (extras\google\google_play_services). Supposing that this is the correct way to "add the google ad library", I continued and added to the manifest file what they asked for. When I compile the app, I get the error:

D:\Computer Programming\IdeaProjects\Black Square\AndroidManifest.xml:8: error: 
Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

So, as it seems, I did not import it correctly (And from this part on, I don't know how to proceed).

like image 421
Ericson Willians Avatar asked Oct 02 '22 09:10

Ericson Willians


1 Answers

I was struggling with the same problem for a whole week. At the end, I've just ported my project to the latest Android Studio (currently 0.4.6).

Android Studio is based on IntelliJ Idea, so it has all advantages of the IntelliJ (at least as Community Edition), but at the same time has much better integration with Android SDK

I've just created a new project in Android Studio and then moved all relevant sources, resources and manifest to the newly created project.

After porting, adding admob support was as easy as adding these lines to build.gradle:

dependencies {
    compile 'com.google.android.gms:play-services:4.2.+'
}

Android Gradle Plugin automatically "explodes" references AAR of the Google Play Services into the build directory and takes all needed resources and libraries from there.

like image 123
Denis Itskovich Avatar answered Oct 13 '22 11:10

Denis Itskovich