Import new Android Design Support library - android

Hi i'am trying to import the new android support library like this com.android.support:support-design:22.0.0 but i got this error after sync the gradle : failed to find

You have to update your Android Support Repository in SDK Manager, then just add this dependency to your build.gradle:
compile 'com.android.support:design:22.2.0'
com.android.support:support-design:22.0.0 is wrong.

dependencies {
implementation 'com.android.support:design:28.0.0'
}

New Android Design Libraries usually start with androidx word, such as:
AppCompat androidx:
implementation 'androidx.appcompat:appcompat:1.2.0'
CardViex androidx:
implementation 'androidx.cardview:cardview:1.0.0'
However be careful because everything is not start with androidx. For example, old design dependency is:
implementation 'com.android.support:design:28.0.0'
But new design dependency is:
implementation 'com.google.android.material:material:1.1.0'
Recyclerview dependency is:
implementation 'androidx.recyclerview:recyclerview:1.2.0'
So, you have to search and read carefully.

The docs has it wrong.
It should actually be 'com.android.support:design:22.2.0'
as mentioned in their official blog.

With gradle 3 it should be:
dependencies {
implementation 'com.android.support:design:27.0.2'
}

You can use:
compile 'com.android.support:design:22.2.0'
I built a complete example. I hope it helps! https://github.com/erikcaffrey/AndroidDesignSupportLibrary
Remember now is available!
Android Support Library, revision 22.2.1 (July 2015)

ctrl+alt+shift+s in the androidstudio window...
project structure window will appear..
click the app in the menu bar at the left then click dependencies..
then add `com.android.support:design:26.1.0

implementation 'com.android.support:design:28.0.0'
Click on 'File' --> 'Project Structure' (or CTRL+ALT+SHIFT+S) --> Select 'Dependencies' --> Click on '+' in the 'All Dependencies' section --> Select '1.Library Dependency'--> here you can search for any library to implement in your android studio project.

i was facing the same problem actually this is old one.
Just replace it with the following code:
implementation 'com.google.android.material:material:1.1.0'

Related

What exactly is runtimeOnly on androidx.appcompat:appcompat

I'm working with old version of appcompat, but error after migrate to androidX.
implementation 'com.android.support:appcompat-v7:28.0.0'
Should i use implementation instead of runtimeOnly ?
After androidx migration your dependency would have been changed to following:
implementation "androidx.appcompat:appcompat:1.5.1"
If above is already present in your build.gradle then you can safe remove appcompat-v7 dependency.
As far as using implementation or runtimeOnly it totally depends upon dependency usage. If its usage in compile time then use implementation or if this just require in runtime use runtimeOnly.
To get your answer please refer to the link: Dependency configurations
According to the description mentioned in above link:

Android Studio:An alert box showed when I try to add RecyclerView

Warning text is:
This operation requires the library androidx.recyclerview:recyclerview:+.
Problem: Inconsistencies in the existing project dependencies found.
Version incompatibility between:
- androidx.appcompat:appcompat:1.1.0#aar and:
- androidx.appcompat:appcompat:1.1.0#aar
With the dependency:
- androidx.annotation::1.1.0 versus:
- androidx.annotation::2.0.0
The project may not compile after adding this library. Would you like
to add it anyway
After I chose OK and added the RecyclerView,I still can't use it because when I selected the added RecyclerView it shows No component selected in the Attributes.
Add this in your app.gradle
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.android.support:recyclerview-v7:29.0.0'
or you can add the Google Material Design Lib using
implementation 'com.google.android.material:material:1.0.0'
So you can use all Material Components like CardView, SnackBar, etc
Hope this will help!

error: package android.support.v7.app does not exist after migrating to android x

I have migrated to android x, Included google()repo to build.gradle(project's) and implementation 'com.android.support:appcompat-v7:22.0.0' to app's build.gradle, After migrating to android x can not install support libraries through sdk manager. how can i solve this? I have visited similar questions and no suitable answer for my case.
Try to use AndroidX version of appcompat
implementation 'androidx.appcompat:appcompat:1.1.0'
Instead of
implementation 'com.android.support:appcompat-v7:22.0.0'

android x design dependency

How can I import androidx design dependency
I have tried to import : implementation 'androidx.design:design:1.0.2'
app compact version is : implementation 'androidx.appcompat:appcompat:1.0.2'
I have got this error -
ERROR: Failed to resolve: androidx.design:design:1.0.2
try this:
implementation 'com.google.android.material:material:1.0.0'
To know equivalent for new Androidx Artifacts from old build artifacts, please refer the below link
https://developer.android.com/jetpack/androidx/migrate/artifact-mappings
note: answer by Poyyamozhi Ramakrishnan is correct and I posted my answer for better understanding.
implementation 'com.google.android.material:material:1.2.0-alpha02'
Just copy paste this one in to your dependencies.
There is no design library in androidx. It uses material library. Get more info at
this
implementation 'com.google.android.material:material:1.2.0-alpha06'
Try this latest dependency.
Try this: 'com.google.android.material:material-rc01'

Android Navigation Component: Fragments are not visible in drop down list when adding destination from nav_graph.xml

When I am trying to add a destination when clicking
"New destination" button, from the dropdown list I am not able to see any fragments which are already there in my project.
I also face this issue when I am trying to add a blank fragment by clicking "Create a blank destination" option from the drop down.
I tried restarting the IDE, and this Android Navigation Component Not Displaying Fragment but it doesn't resolve my issue.
Navigation dependency: implementation "androidx.navigation:navigation-fragment:1.0.0-rc02"
My project is already migrated to AndroidX.
Am I missing something? Any help would be appreciated.
Gradle dependency:
def nav_version = "1.0.0-rc02"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "android.arch.navigation:navigation-fragment:$nav_version"
I had the same problem.
Just use these dependencies.
//Android Navigation Architecture
implementation "androidx.navigation:navigation-fragment-ktx:2.1.0-alpha05"
implementation "androidx.navigation:navigation-ui-ktx:2.1.0-alpha05"
I had the same problem and i solved it by simply checking the superior build-gradle for the kotlin version, it may be the case if you recently updated your kotlin plugin but didnt update your code.
So in android studio in project navigation bar(ANDROID): Gradle Scripts -> build.gradle(project) -> look for buildscript - ext and update "kotlin_version" for your kotlin plugin version (this can be checked in tools -> kotlin -> Configure kotlin plugin updates)
I also had the exact same problem, I was using older library version(1.0.0-alpha05)
But as soon as I switched to
implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
Other fragments started showing up!
I am facing this issue even with version 2.2.1. I have solved this by adding the fragment in the XML code. Then I am able to add actions from the visual editor.
Example:
<fragment
android:id="#+id/test"
android:name="com.example.test.ui.test.TestFragment"
android:label="Test Label"
tools:layout="#layout/fragment_test"/>
Sometimes Fragments don't show up in the graph because classes haven't been made for them. After calling onViewCreate within a class, while returning correct inflater they show up in the graph.
Just I built and Run the project once. Then Fragments appeared as destinations in the Fragments List in NavGraph.

Categories

Resources