Conflicting Task<ReviewInfo> class, google service gms vs core - android

I encountered this error while building my app after adding in app review feature. Other similar problems seems to advise on correcting the dependencies version but both gms and core seems to be on the latest (no warning sign on android studio). What direction should I go in order to fix this problem?
error: incompatible types: com.google.android.gms.tasks.Task<ReviewInfo> cannot be converted to com.google.android.play.core.tasks.Task<ReviewInfo>
Snippet of my gradle file
implementation 'com.google.android:flexbox:0.3.2'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.github.kexanie.library:MathView:0.0.6'
implementation "com.google.android.play:core:1.10.3"
implementation("com.google.android.play:review:2.0.0")
testImplementation 'junit:junit:4.13.2'
//implementation 'com.google.android.gms:play-services-measurement-impl:17.5.0'
implementation 'com.google.android.gms:play-services-ads:21.2.0'
implementation 'com.android.billingclient:billing:3.0.2'

Found the problem.
Per https://developer.android.com/guide/playcore, I removed the core dependency ("com.google.android.play:core:1.10.3") and update any existing import statements of Task objects from import com.google.android.play.core.tasks.; to import com.google.android.gms.tasks.;

Related

Android Gradle Libraries Conflict

I'm trying to implement Firebase dynamic links in an application that already uses Firebase, but once I added the needed libraries for dynamic links I started receiving this error:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0.
2]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
these are the old dependencies related to Firebase that were previously used in the app:
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-ml-vision:24.0.1'
and these are the new ones I'm trying to add:
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:26.0.0')
// Declare the dependencies for the Dynamic Links and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-dynamic-links-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
I'm not sure which dependency the error is referring to that need to be updated.
If you're going to use the Firebase BoM:
implementation platform('com.google.firebase:firebase-bom:26.0.0')
you should specify all of your Firebase depedencies without version numbers, and let the BoM assign them, so that they are all compatible with each other. This means stripping off the version numbers for the dependencies you added for FCM and others:
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-ml-vision'
I don't know about 'com.google.android.gms:play-services-auth:17.0.0' - you might have to make sure that one is manually up to date to the latest version.

The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten

I'm learning developing app for android. In particular, how it works a mediaplayer. The target system should be android for automotive. For this reason I have downloaded a sample UAMP application from google but, unfortunately, doesn't compile, it is too old. So I decided to rebuild a project and importe all the modules. For me is important understand how it works! Anyway, I have imported all libraries, in gradle and in the modules, I have compiled the automotive version of the app and I have this message:
*The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx*.
In detail, the gradle explains:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':automotive:mergeDebugJavaResource'.
Could not resolve all files for configuration ':automotive:debugRuntimeClasspath'.
Failed to transform kotlin-android-extensions-1.3.41.jar (org.jetbrains.kotlin:kotlin-android-extensions:1.3.41) to match attributes {artifactType=android-java-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\James Tiberius Kirk\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-android-extensions\1.3.41\3bb1958b60435763b1299eb4e2dea5bea3bab2a3\kotlin-android-extensions-1.3.41.jar.
> Failed to transform 'C:\Users\James Tiberius Kirk\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-android-extensions\1.3.41\3bb1958b60435763b1299eb4e2dea5bea3bab2a3\kotlin-android-extensions-1.3.41.jar' using Jetifier. Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
This is a known exception, and Jetifier won't be able to jetify this library.
>
Ok, sorry for my poor english, but the problem is quite complex and my english is not so advanced. The project for automotive is composed by three branches, the mobile app, the automotive app and a shared branch. Now I am working on the automotive branch, and its includes the shared branch.
The first thing I did was check if may be one or more included libraries were not the last release. And as I can understand all the libraries are the last version and compatible with androidx (my target system) here the list of include libraries on the Automotive branch:
>
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
implementation "androidx.core:core-ktx:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.preference:preference:1.1.1"
androidTestImplementation "androidx.test.ext:junit:1.1.1"
androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0"
implementation "com.google.android.exoplayer:extension-mediasession:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-core:2.11.4"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
implementation "com.github.bumptech.glide:glide:4.11.0"
implementation "com.google.gms:google-services:4.3.3"
implementation 'com.google.android.gms:play-services-drive:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.apis:google-api-services-gmail:v1-rev72-1.23.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation project(path: ':shared')
}
In the shared branch the included libraries are:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
implementation 'androidx.media:media:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
implementation "com.google.android.exoplayer:extension-mediasession:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-core:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-dash:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-ui:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-hls:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:2.11.4"
implementation "com.github.bumptech.glide:glide:4.11.3"
}
So, I have tryed any thing I know, but the issue is still there. Is there anyone, that can give me a suggestion, an Idea, something that can help me to solve this problem and proceed on the training?
Thanks a lot for any contribute.
The UAMP version1 is not supported anymore, and will not work because a lot of things in it are deprecated. my advice is don't import the project and change it. you need to build your own from the ground up.

error: package android.support.v7.widget does not exist

I'm trying to use an SDK given with the RFID scanner I recently bought.
I'm trying to run the sample code given, but it won't compile. I get the following errors on compilation:
error: package android.support.v7.widget does not exist
error: package RecyclerView does not exist
I've tried all the solutions on similar posts, and I'm pretty sure I have the support library correctly installed.
Here are all my dependencies in my build.gradle (app)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'com.google.android.material:material:1.1.0-alpha08'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
implementation project(':Rfid.AsciiProtocol-Library')
implementation 'com.android.support:appcompat-v7:+'
implementation 'com.android.support:recyclerview-v7:26.0.0'
}
I'm new to Android Studio, and as I said I tried pretty much all the answers for similar problems and nothing works. Any help welcome :)
Thanks a lot in advance,
Cyril
You should replace android support recyclerview with androidx
implementation 'androidx.recyclerview:recyclerview:1.0.0'
And you can delete 'com.android.support:appcompat-v7:+' dependency, because you've already import it with
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
It frustrated me for literally hours because the answer here given is missing so much.
In dependencies of gradle:
import:
implementation 'androidx.recyclerview:recyclerview:1.0.0'
click gradle sync (should be a bar on top of the page that pops up
Then in your java file where u actually use the RecyclerView class, import this:
import androidx.recyclerview.widget.RecyclerView;
and you are done
EDIT: So apprently you just need to auto-fill the object you need and android studio will auto inport for you. example:
try to type recyclerview, but press tab to auto-fill it. The object should automatically be imported for you on top of the java page. This works with all android studio objects like view and intent.

leandroBorgesFerreira/LoadingButtonAndroid Implementation Error

I'm try to use this button style this link But I had Implementation error, my build.gradle like that:
That's my dependencies :
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test🏃1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
And the error:
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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-19:19 to override.
How can I fix that?
I guess this error is happening because their latest version is using AndroidX but your app is still using Support Library.
So, I guess there are two possibilities:
Downgrade library version
Checking their release history, it seems the AndroidX was introduced on version v2.0.0. So, use an old version: v.1.14.0. Just use implementation 'br.com.simplepass:loading-button-android:1.14.0'
Migrate to AndroidX.
You may also consider to migrate to Android X since Android Support library is now deprecated. For any case, you may want to check first solution to ensure the problem is really being caused by the AndroidSupport/AndroidX conflict
Edit
Just sharing more info since you are not aware about the AndroidX.
When developing an Android App, you probably want to build a single APK which works in different Android Versions. However, as you may imagine, there are some differences between different Android versions such as methods that are no longer used (deprecated) or were added later etc. Features that exists in a version but not in others etc.
For this reason, you will end up using the Android Support Library.
It is a special library which helps you to support several Android versions. Not only that, but some views such as ConstraintLayout, RecyclerView and CardView were released as a library.. as part of the Android Support Library.
In your build gradle, we can see that you are already using the Android Support Library:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
However, on last year, Android deprecated the Support Library and created the AndroidX. In a certain way, it is the same thing.. Just a different name..
Sooner or later, you will migrate your app to Android X since support library won't be updated anymore.
However, not only you app will migrate to AndroidX but some third party library will move to AndroidX as well. In this case, we have the library LoadingButtonAndroid that started to used the android X in version v.2.0.0. However, since you didn't migrate your app yet, you have some this kind of conflit. So, you fix by either using an old version of LoadingButtonAndroid or by migrating your app to AndroidX.
HERE you can find how to migrate your app to AndroidX. Usually, it is a very simple process. However, Android Studio always forget to change some import and you have to manually change from support library to androidx.
Automatically or manually, migrating to AndroidX just means that you have to update your imports from android.support.v7.app.AppCompatActivity to androidx.appcompat.app.AppCompatActivity
As you can see, class name is the same and there's no code changes... All the views are the same.. Just their package (import) that is different.

How to fix appcompat gradle error? android 3.4

Having continuous problems with my gradle. The
implementation 'com.android.support:appcompat-v7:28.0.0'
is underlined in red
This is stopping me from continuing in my development (i'm still very new to android). My problem initially started with
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
being underline in red and causing an error, but changing my import to
import androidx.fragment.app.FragmentActivity;
cured the problem, but my gradle still is having build problems. I have android 3.4, and my gradle wrapper is 5.1.1. I have no idea how to stop the error from occurring and getting rid of my gradle errors.
I've changed it to alpha1, rc01 and tried downgrading the version but its not working.
The dependencies is where my problem is occuring:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha7'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:17.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'
}
I just want the gradle to full work and be able to move on haha, I've been trying to fix this for a while...
You are still using older support libraries hence the errors persist even in the app level Gradle file. Add these to your Gradle:
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
After replacing these with your current implementations in your Gradle, sync the project. After that, clean/rebuild the cache.
Now the code you have wrote is most likely going to give error because the code was using older support library which is no longer in your project. To solve it, you need to rewrite the error code but this time using androidx imports.
You need to refactor your project to androidx
Go to Refactor -> Migrate to androidx
Click on Migrate

Categories

Resources