Gradle dependency error after upgrading to Android Studio 3 - android

I have just upgraded Android Studio to the latest version. With the new version a new gradle version is being used and several changes have been made to gradle as well. I have followed the guides to update my gradle file and all errors are gone except the following one:
Error:Execution failed for task ':app:preFreeDebugBuild'.
Android dependency 'com.google.android.gms:play-services-ads' has different version for the compile (10.0.1) and runtime (11.0.4) classpath. You should manually set the same version via DependencyResolution
I have checked and made sure that only version 11.0.4 is used in my gradle file (google ads, analytics etc). The problem seems to arise from using the Facebook ads SDK - I have checked the latest integration guide on AdMob and I am using the latest Facebook SDK, i.e.,
implementation 'com.facebook.android:audience-network-sdk:4.26.0'
implementation 'com.google.ads.mediation:facebook:4.26.0.0'
If I remove the above statements the project compiles with no problems. If I include the facebook sdk I get the error above so I am thinking that the Facebook SDK is using version 10.0.1 of Google ads and that is why the problem is happening.
Is there a way to fix this?

I upgrade Android Studio to 3.0 but keep gradle plugins version at 2.3.0. This will keep all your dependencies with compile, no need to change to implementation.

I had a similar issue today after updating to Android Studio 2.3.
I had to update my build tools to 25.0.0 you can do this by changing the buildToolsVersion and changing the compileSdkVersion to 25 in the build.gradle file in your main module.
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
...
}

Related

Do all my dependencies (libraries that I am using) for my android studios project have to be using a Gradle version equal to or less than mine?

So let's say I have an application on android studios using Gradle version 4.1 with Gradle plugin version of 3.0. I have added implementation 'com.facebook.android:facebook-login:8.2.1' to my build.gradle file. However com.facebook.android:facebook-login:8.2.1 is using Gradle version 4.4.
So the only way for me to use this library (and that version) is if my project is on Gradle version 4.4 or greater?
Or is there a way for me to use that library (and that version) without changing my Gradle version?
Thanks.
Update: More Info
So specifically I am talking about using the stripe API. I was on version 6.1.2 but because of some new EU law, I need to update the version I am using to at least 9.1.1.
I noticed the only time I get this error 'apptransformClasseswithdesugarfordebug' when trying to run my app, is after they update there Gradle to use version 3.4.1 from 3.4.0 (not the Gradle plugin). On version of Stripe 9.0.0, my app is able to run, however, after switching to version 9.1.1, I get that error.
Note, my project is on Gradle version 3.1.4 and when it's on Stripe version of Gradle 3.4.0, my app is able to run.
So to wrap it up, I need to know if I need to be on the same version, although I doubt it because my app works with 9.0.0 of Stripe, which is using a different version of Gradle.

All gms/firebase libraries must use the exact same version specification but firebase doc gave me different version

My Android Studio giving me an error see below images
but firebase doc gave me a different version of many libraries, here is the doc
So my question is if firebase doc gives me this different version of libraries then why is android studio giving me this error?
Upgrade the version of the version of the google services gradle plugin to the latest in you top-level build.gradle:
classpath 'com.google.gms:google-services:4.0.1'
This is the plugin that checks for proper versions. Only newer versions of this plugin understand the new versioning system of the libraries.
Use the following google service plugin:
classpath 'com.google.gms:google-services:4.0.1'
and upgrade firebase invites:
implementation 'com.google.firebase:firebase-invites:16.0.1'
As per one of comment suggested, Upgrading an Android Studio and Gradle version Did solve my problem, Previously I was using Android Studio 3.0 and after upgrading to Android Studio 3.1.3 this error was gone.
Below are the changes that I have made.
Updated Android Studio from 3.0 to 3.1.3
Updated Gradle Version to 4.4
If this will not fix your problem then try to upgrade your Google plugin version to the latest one
classpath 'com.google.gms:google-services:latest.version'

CanĀ“t use add-on in Android Studio: "platform not found"

In our project we are using an add-on instead of the standard Android SDK.
There is a new version of the add-on, it is in the add-ons folder, listed among the SDKs to compile with, but when we select it, we get an error from gradle saying:
Error: Module 'app' platform 'add-on_name' not found.
Open Android SDK Manager and install all missing platforms.
Our current setup is:
Android Studio 3.0 canary 5
gradle wrapper distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
gradle classpath 'com.android.tools.build:gradle:2.3.2'
buildToolsVersion '25.0.3'
I have submitted the issue with the add-on developer, but it seems more like an Android tools/Gradle bug, so I am trying my chances here. It used to work without issues before Gradle 2.0/Android Studio 2.3

Integrating react-native with existing app with buildToolsVersion 24

I'm trying to integrate react-native into an existing Android application, but keep running into the following error:
> Could not find com.android.support:appcompat-v7:23.0.1.
It seems like react-native needs sdkBuildTools version 23.0.1 and appcompat-v7 version 23.0.1.
However, the application I'm working on depends on sdkBuildTools version 24 and also appcompat-v7 version 23.2. Downgrading these dependencies is not an option.
Does this mean I can't integrate react-native into the app without rebuilding react-native from source with bumped up dependencies?
Go to android SDK manager and install build tool version 23.2 and change sdkBuildTools of every gradle in your project to 24 and also it will ask you after install that you have new version of SDK tools installed would you like to change the configuration, you can click on it .. If not then reach out to your app's gradle and change the appcompact version
One last step you need to do is change classpath version of your project and that will be notified by the android studio or i think 2.3.0 would be merely fine.
Cheers :)

How to set the minimum SDK Build Tools version required in an Android Studio project?

When I try to run my React Native project in the Android emulator I get the following error:
The SDK Build Tools revision (23.0.1) is too low for project ':app'.
Minimum required is 25.0.0
My android/app/build.gradle file specifies:
buildToolsVersion "23.0.1"
On Android Studio, it also logs the same error for each of the packages I'm using:
I believe this started happening after I inadvertently updated some stuff that Android Studio suggested.
All the build.gradle files that I've checked specify version 23.0.1, but for some reason 25.0.0 seems to be overriding that setting.
How do I go about correcting this?
Ran into this issue and realized that the error is quite vague. Coming from an iOS background into React Native, I've had to learn a lot more about the Android ecosystem. The problem is that your project Gradle version is too high.
In your project's (top level) build.gradle you may be using:
classpath 'com.android.tools.build:gradle:2.3.1'
Gradle v2.3.1, implicitly sets the minimum SDK Build Tools revision to 25.0.0.
To fix, you can simply revert back to:
classpath 'com.android.tools.build:gradle:2.2.3'
This will allow your project's modules to use buildToolsVersions 23.0.1 or 25.0.2
Install required Build Tools version 25.0.0
Update buildToolsVersion in build.gradle file and sync project
Set compileSdkVersion 25 and targetSdkVersion 25
Clean and Build your project again
Finally, Run on device
Hope this will help~
May be you are updated your studio version and open your old project if you do that then you want to go to package explorer app and right click on it and open modual setting one window open then select the project and set the Gradle version
and android plugin version
example
My studio version is 2.3
then Gradle version = 3.3
and Android plugin version = 2.3.0
if you not find then create new project blank project and see the setting and apply on your project
Android SDK Build Tools are required to build Android apps (see https://developer.android.com/studio/command-line/index.html#tools-build). It's recommended to always use the latest version.
In your case react* libraries aren't compatible with current build tools version (23.0.1) so you need to upgrade (25.0.2 is the latest version at the moment).
The version is specified in build.gradle of your module. After syncing project everything would be fine or an error will be displayed that will suggest installing the missing version. Android Studio will do that for you.
android {
...
buildToolsVersion "25.0.2"
Uninstall all new-ones 'Android SDK Build-Tools' versions after comes 23.0.1 in SDK Manager and Sync and try again for that project only...

Categories

Resources