When the implementation 'com.karumi:dexter:6.0.0' is added in build.gradle file, Error is shown on line number 24 while implementing appcompat:implementation 'com.android.support:appcompat-v7:26.1.0'
its the build.gradle(Module:app)
Error in Gradle
From your gradle error message, it is seen that your are using the andorid earlier project structure library.
You are trying to implement implementation 'com.karumi:dexter:6.0.0' library which is using the androidx support library structure.
Hence, your are getting that error as you cannot use both the structure as they have been made and organized complete differently.
Solution:
Shift to androidx library structure if you really want to use that library.
Refer this official documentation of Google Android to migrate to andoirdx from android -
Google Developers Documentation
The library you are trying to use is using AndroidX libraries and you are using Andeoid support libraries in your project. Either migrate your project to androidx or ise an older version of the library which use android support libraries.
You should migrate your project AppCopact to AndroidX. For migrating project AppCompact to Androidx Go Refactor -> Migrate to Androidx then tick on BackUp Project and Migrate. After Migration The com.karumi:dexter:6.0.0 library will work perfectly.
Related
I'm trying to implement notifications following the example at https://developer.android.com/training/notify-user/build-notification
However, the guide shows an implementation of
dependencies {
implementation "com.android.support:support-compat:28.0.0"}
But when I try to add the dependency in my gradle file I get this error:
Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with this: Refactor > Migrate to AndroidX..
So what is the AndroidX version of this library?
That would be
implementation "androidx.core:core:1.3.2"
You can find a list of all the mapping to AndroidX at https://developer.android.com/jetpack/androidx/migrate/artifact-mappings
After upgrating flutter version to Flutter 1.22.0-2.0.pre.78 • channel master I am getting this warning:-
WARNING:
[Processor] Library
'C:\Users....gradle\caches\modules-2\files-2.1\io.flutter\flutter_embedding_debug\1.0.0-b1d9f863db32cb1d6714cf75db4a992ee3765113\b8748b5192a2a0961f5c14f8845331ad5f2225a1\flutter_embedding_debug-1.0.0-b1d9f863db32cb1d6714cf75db4a992ee3765113.jar'
contains references to both AndroidX and old support library. This
seems like the library is partially migrated. Jetifier will try to
rewrite the library anyway. Example of androidX reference:
'androidx/annotation/VisibleForTesting' Example of support library
reference: 'android/support/annotation/NonNull'`
Is this issue will cause some serious issue in future or not. Thanks in Advance :)
This warning exist because on the latest Flutter versions newly created projects will be created with AndroidX automatically.
Starting from Flutter v1.12.13, new projects created with flutter create -t <project-type> use AndroidX by default.
Projects created prior to this Flutter version must not depend on any
old build
artifact
or old Support
Library
class.
In an app or module project, the file android/gradle.properties or
.android/gradle.properties must contain:
android.useAndroidX=true
android.enableJetifier=true
The warning also stated:
This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
This is usually caused by some plugins that was not migrated and Flutter tool uses Jetifier which will automatically migrate those Flutter plugins using the Support Library to AndroidX.
The Flutter tool uses Jetifier to automatically migrate Flutter
plugins using the Support Library to AndroidX, so you can use the same
plugins even if they haven’t been migrated to AndroidX yet.
You can open an issue to GitHub if you've encounter other issues when migrating to AndroidX.
I am trying to implement card view by implementing it in my build.gradle.
However while doing this, I am getting an error. It is saying
"Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with this: Refactor > Migrate to AndroidX... less... (Ctrl+F1)"
I understand how to do it but am not sure if I should since I am not getting any build errors and my gradle is still syncing. Can someone tell me whats going on?
You are using androidx libraries together with a very old version of support library of cardview.
Remove the dependency of support library
//implementation 'com.android.support:cardview-v7:16.0.4'
and add:
implementation 'androidx.cardview:cardview:1.0.0'
More info about androidx here.
You have another option.
Just add the MaterialCard included in the official Material Components library:
implementation 'com.google.android.material:material:1.1.0-alpha10'
and in your xml you can use:
<com.google.android.material.card.MaterialCardView
...>
Just open your project and make the compile and target version to 28 , then sync then go to refractor on toolbar of studio , there you will see migrate to android x just tap on that. It will resolved all your issue.
My current project is quite stable. Presently I don't want to migrate to Androidx. But I need to use this com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.3 library in my project, which is migrated to Androidx. So when I'm importing this library it causes gradle build failure.
I found many ways for migrating to Androidx but not the other way.
One solution I can think of downloading the library and replace the Androidx libraries with support and then import. Apart form this is there any other way ? Like the reverse of jetifier.
I find two new refactor commands, what are the exact functions of
refactor>migrate app to appCompat
refactor>migrate to androidX
Support (compatibility) libraries was changed to AndroidX libraries by Google.
So in the nearest future support libraries won't be supported anymore.
So "migrate to androidX" will do the following:
Android studio will change all imports in your class from android.support. * to androidx. *
Dependencies of your build.gradle will be also changed to relevant androidX libs