implementation 'com.google.android.libraries.places:places:1.0.0'
error as follows:
ERROR: The library com.google.android.gms:play-services-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.1.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
Use the latest dependency version.
Edit your app level build.gradle file.
dependencies {
implementation 'com.google.android.libraries.places:places:2.4.0'
}
Related
A project has multiple modules, two of which are named :app and :prefs.
The project build.gradle,
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21"
and :app build.gradle,
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"
...
implementation project(":prefs")
work fine. However, the :prefs library requires the latest coroutine features,
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
but the following error occurs:
jetified-kotlinx-coroutines-android-1.6.0.jar!/META-INF/kotlinx-coroutines-android.kotlin_module:
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.13.
Is it possible to have separate versions of the same dependency ... one in each module?
I'm trying to update my google and firebase SDK libraries in my project to solve the problem of install_referrer deprecation but I got errors after sync
ERROR: Failed to resolve: com.google.firebase:firebase-crash:17.2.2
and this error on the merged manifest
ERROR: Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:28:5-422:19 to override.
here is my firebase and google dependency
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-crash:17.2.2'
implementation 'com.google.firebase:firebase-config:19.1.1'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.google.firebase:firebase-ads:18.3.0'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
Use the following dependency:
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
And Update your application to use AndroidX:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
https://developer.android.com/jetpack/androidx/migrate
Update:
You can now use the following dependency version:
dependencies {
// Recommended: Add the Firebase SDK for Google Analytics.
implementation 'com.google.firebase:firebase-analytics:17.5.0'
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
}
If you are having trouble adding firebase-crashlytics, then check the following documentation:
https://firebase.google.com/docs/crashlytics/get-started?platform=android
https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android
Try to change com.crashlytics.sdk.android:crashlytics:17.2.2 to com.google.firebase:firebase-crashlytics:17.2.1.
This worked for me.
Steps to add the new Firebase Crashlytics before november deprecation
from your build.gradle project module
// Remove Fabric's Maven repository from allProjects.
maven { url 'https://maven.fabric.io/public' }
// Remove the Fabric Gradle plugin.
classpath 'io.fabric.tools:gradle:1.31.2'
// Add the Firebase Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
From your build.gradle app module
// Remove the Fabric plugin.
apply plugin: 'io.fabric'
// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
// Remove the Fabric Crashlytics SDK.
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
}
The links commented with // Remove should not be in your gradle configuration, instead add the suggested dependencies and plugins
Source: https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android
As a quote from Peters answer, you should also have
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in
Migrating to AndroidX.
Follow below document to intergrade crashlytics into your project
https://firebase.google.com/docs/crashlytics/get-started?platform=android&authuser=0#add-sdk
Project requirements
compileSdkVersion 29 or later
Gradle version com.android.tools.build:gradle:4.0.1
if your project not contains androidX then Migrate your project into AndroidX
https://developer.android.com/jetpack/androidx/migrate
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:29.0.0')
// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
Refrence
I want to add custom lint rules to my projects, but I get error while syncing project.
Execution failed for task ':app:prepareLintJar'.
Found more than one jar in the 'lintChecks' configuration. Only one file is supported. If using a separate Gradle project, make sure compilation dependencies are using compileOnly
How can I check which library or module is adding another jar?
I fixed problem. My dependencies in my custom rules module was
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compileOnly 'com.android.tools.lint:lint-api:26.5.3'
compileOnly 'com.android.tools.lint:lint-checks:26.5.3'
}
I changed kotlin dependency to compileOnly and it worked
dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compileOnly 'com.android.tools.lint:lint-api:26.5.3'
compileOnly 'com.android.tools.lint:lint-checks:26.5.3'
}
I’m trying to define all my dependencies in a bill of materials (BoM) platform module so the other modules in my multi-module project can use the same versions. All works fine except the kapt dependencies. In those I get this error:
Could not determine the dependencies of task ':app:kaptDebugKotlin'.
> Could not resolve all task dependencies for configuration ':app:kapt'.
> Could not find com.google.dagger:dagger-compiler:.
Required by:
project :app
For example with this platform (:bom) module:
plugins {
id 'java-platform'
}
dependencies {
constraints {
api 'com.google.dagger:dagger:2.25.2'
api 'com.google.dagger:dagger-compiler:2.25.2'
}
}
I'm getting that error when I use it like this in the app module:
dependencies {
implementation platform(project(':bom'))
implementation 'com.google.dagger:dagger'
kapt 'com.google.dagger:dagger-compiler'
// ...
}
I’m getting the same error if I use annotationProcessor. If I set the version like kapt 'com.google.dagger:dagger-compiler:2.25.2' all works.
What am I doing wrong? Can I use BoM for kapt or annotationProcessor?
you are missing kapt platform(project(':bom'))
kapt doesn't include dependencies from implementation, so it doesn't include the platform either
I am migrating my Android project to Gradle 4.4 and Android Gradle plugin 3.1.2.
It has a library module which depends on parceler library and defines its dependency as follows:
build.gradle of library module:
...
// parceler for serialization (https://github.com/johncarl81/parceler)
implementation "org.parceler:parceler-api:1.0.4"
annotationProcessor "org.parceler:parceler:1.0.4"
...
This seems to compile well and generates my aar file.
Further, my main app module also has a direct dependency on parceler module and contains above lines as dependencies in its build.gradle, along with above aar file.
build.gradle of main app module:
...
api(group: 'com.example.mylibrary', name: 'mylibrary', version: "1.0.7", ext: 'aar') {
transitive = true;
changing = true
}
// parceler for serialization (https://github.com/johncarl81/parceler)
implementation "org.parceler:parceler-api:1.0.4"
annotationProcessor "org.parceler:parceler:1.0.4"
...
Everything works until I try to generate my APK, which fails with the following error.
D8: Program type already present: org.parceler.Parceler$$Parcels$1
Task :MPCApp:transformDexArchiveWithDexMergerForRelease FAILED
When I expand my library project in Android studio, I see Parcels.class under org.parceler package. But it seems similar file is also generated by main app module under the same package which is causing the clash.
Upgrade to the latest (currently 1.1.10) - We got rid of the Parcels generated class.