Admob gradle dependency - android

I am trying to move to gradle in my project and I've got problem while install admob
dependency
compile group: 'com.google.guava', name: 'guava', version: '12.0'
compile ('com.google.android.gms:play-services:4.+'){
exclude module: 'com.google.ads'
}
compile 'org.codehaus.plexus:plexus-interpolation:1.19'
compile 'de.greenrobot:eventbus:2.0.2'
compile 'com.squareup.retrofit:retrofit:1.4.1'
compile 'com.squareup.picasso:picasso:1.1.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.apache.commons:commons-lang3:3.0'
compile fileTree(dir: 'libs', include: '*.jar')
And I am geting
Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
in my libs folder only one
GoogleAdMobAdsSdk-6.4.1.jar

If your using Google Play services , then remove the GoogleAdMobAdsSdk jar from lib folder
You can also exclude the ads from play service like this, to continue with jar.
compile ('com.google.android.gms:play-services:4.3.23'){
exclude module:'gms.ads'
}
But you need to upgrade soon.
Note : Deprecated. On August 1, 2014, Google Play will stop accepting new or updated apps that use the old standalone Google Mobile Ads SDK v6.4.1 or lower. You must upgrade to the Google Play version of the Mobile Ads SDK by then.
Read these links
https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration
https://developers.google.com/mobile-ads-sdk/download#downloadplay

Related

Android studio getting stuck when run project

I have update the google play service version to 7.+, this version is required for GoogleApiClient, After updating google play version when i run project it will take much time and stuck entire computer.
Please guide.
thanks
Make sure to use required Google API in project. What you need in your project.
dependencies {
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
Note: Do not use complete google dependencies
dependencies {
compile 'com.google.android.gms:play-services:8.3.0'
}

Android, one library with old google play service conflicts with google maps

I'm using asne google plus library for my project. It uses older version of google play service.
When I add Google maps with newer version, gradle build fails with this message:
Error:Execution failed for task ':app:processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'
My dependencies in my app.gradle:
compile 'com.github.asne:asne-googleplus:0.3.3'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
When I make asne like this:
compile ('com.github.asne:asne-googleplus:0.3.3') {
transitive = true
}
This lib becomes invisible and I can't call its methods.
How to resolve this conflict?
I suggests that you use the entire dependency
compile 'com.google.android.gms:play-services:8.3.0'
and not split it into parts like play-services-location:8.3.0 and play-services-maps:8.3.0. This link provides a detailed explanation why.
You could try to just exclude the google dependencies of the library:
compile ('com.github.asne:asne-googleplus:0.3.3') {
exclude group: 'com.google.android.gms'
}

Android Studio: Could not find any version that matches com.google.gms:play-services:6.1.+

I've recently updated my android studio and when I try to sync my gradle file I get the below error:
Could not find any version that matches com.google.gms:play-services:6.1.+
I understand that Android Studio ships with it's own sdk so I've installed the ADT sdk and pointed my project to this but I still get the same error, here are my gradle dependencies:
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile files('libs/Parse-1.4.2.jar')
compile project(':ws_wrapper')
compile project(':custom_slider_library')
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:6.1.+'
compile project(':shinobicharts-android-library')
compile files('libs/shinobicharts-android-trial-1.3.5.jar')
compile files('libs/androidplot-core-0.6.1-SNAPSHOT.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.2.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
}
I'm unsure as to what to do next, my sdk manager is up to date, does anyone have any ideas? I can't run this at the moment due to this issue.
If I try to add a dependency via the project structure the google play services isn't available on the maven drop down list.
Just to add this line #integer/google_play_services_version in the manifest is also causing an issue it says cannot resolve symbol
Your SDK isn't actually up-to-date. You need to install revision 12 of the Google Repository; that's the one that ships Google Play Services 6.1.11.

Android Studio with Gradle incompatibility (Google Play Services issue)

I am developing an android app with Android Studio 0.8.9. I am using Gradle to build my project.
I want to include google-play-services.jar file into my project in order to use push notification api.
I have added those statements into my gradle (application layer) file as follows:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/google-play-services.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.2.3.jar')
compile files('libs/volley_23042014.jar')
compile 'com.google.android.gms:play-services:5.2.08'
}
but it never works. I get the following error:
Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
I've checked bunch of websites (including Stackoverflow.com). None of them has worked for me.
I have latest versions of Google Support Library, Google Support Repository, Google Play Services.
Here is my libs directory
My SDK version like:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="20" />
What I have done wrong? If anyone has any idea please let me know.
If you're including Play Services via:
compile 'com.google.android.gms:play-services:5.2.08'
you don't need this:
compile files('libs/google-play-services.jar')
so just remove it.
Since the first line of your dependencies will make it automatically pick up any jar files you put in your libs directory:
compile fileTree(dir: 'libs', include: ['*.jar'])
make sure you remove the jars from there as well.
For that matter, there are other libraries you shouldn't include via specific jars.
Instead of this:
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.2.3.jar')
use this:
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.code.gson:gson:2.2.3
(Note that later versions of GSON are available).

Gradle conflict play-services:4.0.30 with GoogleAdMobAdsSdk

I am using Android Studio 0.3.4 with Gradle build.
I get this error message when I build my project:
Gradle: Execution failed for task > Could not call IncrementalTask.taskAction()
This is because google play services and GoogleAdMobAdsSdk-6.4.1 are conflictiing. My build.gradle has this entry:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v13:13.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
When I remove GoogleAdMobAdsSdk then it builds fine. How can I solve this problem?
this is the error:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$Err
orCode;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:12
3)
thanks
Google Mobile Ads SDK for Android is now included as part of Google Play services 4.0. More info http://googleadsdeveloper.blogspot.com.es/2013/10/upgrade-to-new-google-mobile-ads-sdk.html
As you say, your build.gradle should be without Google Mobile Ads SDK library:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v13:13.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
}
But Google Mobile Ads SDK doesn't support DoubleClick For Publishers, Ad Exchange or Search Ads for Mobile Apps yet. They say that soon will be supported. If this is your case, use the previous version of Play Services combined with Google Mobile Ads SDK:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v13:13.0.0'
compile 'com.google.android.gms:play-services:3.2.65'
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
}

Categories

Resources