google-services-auth crashes with kommunicate - android

I am trying to add Kommunicate services to my Android app.
But when I add the dependencies of kommunicate, I get an error stating that it crashes with the google-services-auth implementation
The dependencies section is as follows:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'com.google.apis:google-api-services-blogger:v3-rev61-1.25.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'io.kommunicate:kommunicate:1.6.3'
implementation 'com.github.GrenderG:Toasty:1.3.1'
implementation 'com.rom4ek:arcnavigationview:1.0.3'
implementation 'com.github.Commit451:ModalBottomSheetDialogFragment:1.1.0'
implementation 'com.android.volley:volley:1.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
The full log is as follows:
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement#[15.0.1], but play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or have
transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto io.kommunicate:kommunicate#1.6.3
-- Project 'app' depends onto com.google.android.gms:play-services-auth#16.0.1
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your build.gradle file.

So silly of me!
The play-services-auth is version 15.0.1:
implementation 'com.google.android.gms:play-services-auth:15.0.1'
But not 16.0.1:
implementation 'com.google.android.gms:play-services-auth:16.0.1'

Related

Cannot access 'androidx.lifecycle.HasDefaultViewModelProviderFactory' which is a supertype of 'FavoriteBottomDialogFragment'. Check your module cla

I am getting error in the whole class that extends BottomSheetDialogFragment
Cannot access 'androidx.lifecycle.HasDefaultViewModelProviderFactory' which is a supertype of 'FavoriteBottomDialogFragment'. Check your module classpath for missing or conflicting dependencies
The class is in app module and this module implements two other modules : core and presentation-core
build.gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project (':core')
implementation project (':presentation-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
testImplementation 'junit:junit:4.12'
implementation "com.google.android.material:material:1.1.0"
//Rx
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxjava:2.2.9"
//Architecture component
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.room:room-runtime:2.0.0'
kapt 'androidx.room:room-compiler:2.0.0'
kapt 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
implementation 'androidx.room:room-rxjava2:2.0.0'
implementation 'androidx.room:room-guava:2.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
}
core dependencies
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4"
api 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.2'
//library to serialize Java Objects between Contexts
implementation 'org.parceler:parceler-api:1.1.11'
kapt 'org.parceler:parceler:1.1.11'
//testing dependencies
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation "org.mockito:mockito-core:2.24.5"
androidTestImplementation "org.mockito:mockito-android:2.24.5"
//architecture component
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
implementation "androidx.lifecycle:lifecycle-livedata:2.0.0"
//RxJava2
implementation "io.reactivex.rxjava2:rxjava:2.2.9"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
}
presentation-core
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
}
BottomSheetDialogFragment
Even with errors i got, I can run the project in a device
I experienced this exact same problem today, and was able to solve.
Turns out the issue was a version mismatch between the expected version of androidx.lifecycle:lifecycle-viewmodel used by the module where the "failing" class is and a later version in some other dependent code.
So in my case, my module was using version 2.1.0 of this module, but one of the dependencies was using version 2.2.0. The code will compile no problem, because gradle resolves the dependency to the latest version; however Android Studio is somehow confused by this situation (not always, because this doesn't happen all the time, but sometimes – this isn't the first time I've seen this.)
Therefore solution is: figure out what the latest version of this library is in your app and update your build.gradle for this module to point to the same version that gradle is resolving to. Or:
run gradlew app:dependencies
search the result for lifecycle-viewmodel
update build.gradle in your app to depend on lifecycle-viewmodel with the version that gradle says it is resolving to
Sync project with gradle files
in my case (an Android module), Android Studio 4.0.1, I get a number of warnings in the IDE related to androidx.lifecycle.HasDefaultViewModelProviderFactory,
I have solved the issue by adding this line to build.gradle:
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
thus the beginning of build.gradle becomes:
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
...
In my case, the problem was solved adding the lifecycle viewmodel dependency in the module of the troubled class.
Add dependency into you build gradle androidx.fragment:fragment-ktx:x.x.x with actual version. For activity you must add androidx.activity:activity-ktx:x.x.x. I hope this helps you, in my case it solved the problem.
I added the following lines to build.gradle to solve the same issue in a module:
def archLifecycleVersion = '2.2.0'
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$archLifecycleVersion"
Your androidx.lifecycle:lifecycle-XXX dependency versions must be the same.
in my case:
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"

Android studio throws a duplicate class error when annotationProcessor is added

I recently just started with android development using kotlin so a total noob at android studio too.
I am trying to build a super simple HelloWorld app but I got this error:
Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- jetified-kotlin-compiler-embeddable-1.3.72.jar (kotlin-compiler-embeddable-1.3.72.jar)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
but when I added the annotationprocessor at the end of my dependencies like:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
annotationProcessor "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
}
I encountered a new error instead when I tried to build:
https://del.dog/pyfunestin
Class duplicate error can be solved by cleaning the project. First clean the project and rebuild it.

Unable to generate signed apk due to lint errors

I am having trouble in generating signed apk. Lint errors displayed on screen
Following error shows
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.0. Examples include 'com.android.support:animated-vector-drawable:28.0.0' and 'com.android.support:exifinterface:27.1.0'
Dependencies in build.gradle file is below:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
//picasso libraray
implementation 'com.squareup.picasso:picasso:2.71828'
//retrofit libraries
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:4.3.1'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
}
On this line
implementation 'com.android.support:appcompat-v7:28.0.0'
lint error occurred
AndroidX replaces the original support library APIs with packages in
the androidx namespace. Only the package and Maven artifact names
changed; class, method, and field names did not change.
Read official guideline about - Migrating to AndroidX. You should migrate to AndroidX.
With Android Studio 3.2 and higher, you can migrate an existing
project to AndroidX by selecting Refactor > Migrate to AndroidX from
the menu bar.
dependencies will be
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Then add below in your build.gradle section.
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

Error:In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[11.0.4]")

I am Using these dependencies , I changed my places version so It shows me error also I wanted to use google places 16.0.0 version.
Dependencies I am using
dependencies {
implementation 'com.facebook.android:facebook-android-sdk:4.39.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:cardview-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.googlecode.android-query:android-query:0.25.9'
//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-location:11.0.4'
implementation 'com.google.android.gms:play-services-maps:11.0.4'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-core:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.android.gms:play-services-ads:11.0.4'
implementation 'com.google.android.gms:play-services-analytics:11.0.4'
Error I am getting :
Error:In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[11.0.
4]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-iid:11.0.4 -> com.google.android.gms:play-services-basement#[11.0.4], b
ut play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.android.gms:play-services-ads#11.0.4
-- Project 'app' depends onto com.google.firebase:firebase-messaging#11.0.4
-- Project 'app' depends onto com.google.firebase:firebase-core#11.0.4
-- Project 'app' depends onto com.google.firebase:firebase-database#11.0.4
-- Project 'app' depends onto com.google.firebase:firebase-auth#11.0.4
-- Project 'app' depends onto com.google.firebase:firebase-storage#11.0.4
-- Project 'app' depends onto com.google.android.gms:play-services-analytics#11.0.4
-- Project 'app' depends onto com.google.android.gms:play-services-places#16.0.0
-- Project 'app' depends onto com.google.android.gms:play-services-location#11.0.4
-- Project 'app' depends onto com.google.android.gms:play-services-maps#11.0.4
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
build.gradle file.
Go to your app folder and open build.gradle,
or platforms/android/app/build.gradle for phonegap app's
add this to end of file:
googleServices.disableVersionCheck = true

Failed to resolve: com.google.firebase:firebase-core:15.0.0

I have a strange issue when integrate firebase:
if you integrate firebase automatically from tools,
The new version of android studio have strange bug, the software inserts
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
instead of
implementation 'com.google.firebase:firebase-database:16.0.1'
fix this line (remove numbers after last ':')
Remove the
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
and add only
implementation 'com.google.firebase:firebase-database:16.0.1'
Because 16.0.1 is added by our self and while after that we connect firebase using the plugin in the studio, it adds a new lib file with 15.0.0.
So that's not required.
Step 1 :
In your root build.gradle file add the repo:
allprojects {
repositories {
google()
maven { url "https://maven.google.com" }
}
}
Now Sync Gradle. This is the directory that contains the repos of Firebase.
Step 2 :(if step 1 doesn't works)
If the Step 1 doesn't works, then it should be because you are using the Gradle in offline mode. If your gradle is set to offline, android studio searches for the cached copies of the dependencies that you want to update and throws an error since it hasn't downloaded the file before.
Go to Settings >> Build, Execution, Deployment >> Gradle.
In the Global Gradle Settings section, disable Offline mode.
Now Sync Gradle again.
Use implementation com.google.firebase:firebase-database:16.0.1 as many wrote before. But also add the line: kapt com.google.firebase:firebase-database:16.0.1:15.0.0
this way firebase keep "Dependencies set up correctly".
after
implementation com.google.firebase:firebase-database:16.0.1
kapt 'com.google.firebase:firebase-database:16.0.1:15.0.0'
add the kapt, it fixed for me
Updated all the dependencies to
dependencies {
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.5'
}
then build -> clean project, build -> rebuild project and is working

Categories

Resources