I can't import card library in my Android Studio - android

Today I install Android Studio in my new Pc, I tried to start a new project but I couldn´t because I have this error when I try to compile some new library of Material Design as CardView or RecyclerView, I was reading about this problem and I tried to do everything, I installed all SDK, I change the library versions a lot times, but I cant resolve this =(.
This is the picture of my error:
Please, any help will be greatfully. I can´t program if I dont resolve this.

Import with compile 'com.android.support:recyclerview-v7:22.2.1' , this should work with API 22.
Click on Sync now in the warning on top of the code window.
If it doesn't work, try Build -> Rebuild Project. Seems that your gradle file doesn't refresh automatically
If it doesn't work check in the SDK Manager that you have install all the SDK pachages needed for those libraries and rebuild again.

Add card view lib from Open module settings-> app -> dependencies-> + -> Library dependency. It will be perfect . this happens you have updated version 22 installed in your sdk and not the previous version 21 .
or use
compile 'com.android.support:cardview-v7:22.2.1'

just use
compile 'com.android.support:recyclerview-v7:22.2.1'
as the popup says the library you try to import doesn't work with android version 22
and to make sure you don't import outdated libraries like this import them that way.
1-
2-
3-

Related

Cannot resolve symbol 'androidx.constraintlayout.widget.ConstraintLayout'

Cannot resolve symbol 'androidx.constraintlayout.widget.ConstraintLayout'
I made an empty activity in Android Studio, ahead of nothing added, in activity_main.xml, there were so many red lines,and the prompt was: Cannot resolve symbol'
while, these code was generated by Android Studio, I tried file->invalidate cashes/restart... and installed all the SDK tools but Google series. The error was still there.
Gradle was successful, and JDK was installed.
Has anyone a solution ?
Make sure constraint layout is updated to latest version:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
This is because your project support android legacy version, check this out in build.gradle, search for this key:
implementation 'com.android.support:appcompat-v7:28.0.0'
If confirmed, you should use the compatible version instead of the androidx version.
That is android.support.constraint.ConstraintLayout.
BTW, are you trying to follow the https://developer.android.com/guide demo? This tutorial sucks.

how to include android library in android studio ????? (Android Studio)

I installed different packages including (SDK) build tools and updated everything but nothing seems to be working, can any one help ?
Thanks in advance.
You should add this in your app gradle:
dependencies {
compile 'com.google.android.gms:play-services:9.6.1'
}
In Android Studio, left most side you can see set of options like Project, Android,Packages, Project files etc.
select Project --> external libraries..add your libraries in it and try

How to fix "Rendering Problems The following classes could not be instantiated"?

I just started learning android coding and I keep getting this error:
Add these support library in build.gradle and also make sure the version of the support library(goto sdk manager and get the version number of sdk platform and place it in below dependancy because version of support library and sdk platform should be matched)
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
Try any of the following
Click refresh button on the preview pane
Sync Project with Gradle files
Click Tools > Android > Sync Project with Gradle Files
Rebuild Project
Click Build > Rebuild Project
This seems to come up periodically with Android Studio and it happened again today on an install I haven't used in a while. There may be more than one solution, but as of today June 08, 2016, I made sure two things are set:
1) Make sure you're on SDK/API 23 (or lower if necessary) vs the N preview, and
2) change the theme to "App theme". You may have to choose "Manifest Theme" in the left column before you can see "App Theme" show up as an option in the right column.
3) hit the refresh button (looks like two arrows in a circle)
Referring to a post above, both the support.appCompat and support.design libraries should be automatically added as dependencies to the gradle file, but you can double check them if necessary (and get the newest ones if the versions have changed).
You should see both of these:
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
Why Google and Jet Brains can't keep this from happening I don't know, but as of today, it cleared the problem right away.

installing repository for com.android.support.recyclerview-v7 for Android Studio error

I'm a beginner in android studio and I try to use a recyclerView. When I try to add compile 'com.android.support.recyclerview-v7:21.0.+' to my gradle file, I get the error:
failed to resolve com.android.support.receyclerview-v7v7:21.0.+.
It proposes me to install repository and sync project. when I click it, i get this error:
SDK Path C:\User\userName\AppData\Local\Android\sdk1
loading SDK information
ignoring unknown package filter 'extra-android-m2repository' warning: The package filter removed all packages. There is nothing to install. Please consider trying to update again without a package filter.
install failed, please check your network connection and try again. You may continue with creating your project, but it will not compile correctly without the missing components.
I mention that I'm using sdk 23.0.0 on a windows system, and when installing android studio for the first time I got an error message that concern proxy (that i unfortunately skipped)!!
Any idea to solve this problem ??!!!
First of all, run the SDK Manager and check if your support libraries repository is updated.
Then open your build.gradle (not the top level file) and add:
dependencies{
//....
compile 'com.android.support:recyclerview-v7:23.0.0'
}
Pay attention. You report in your question a typo in your library (compile 'com.android.support.recyclerview-v7:21.0.+')
Using the v23 you have to compile with API23.
Of course you can use a "old" version using:
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:21.1.3'

Can't import ActionBarCompat from Android Support Library using Android Studio

I am using Android Studio and have followed this article from google as well as some other articles discussing how to use the new ActionBarCompat.
I have downloaded the support library (Rev. 18) in Android SDK Manager and added the following in my build.gradle
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:18.0.0'
}
Now I'm trying to import the Support Library API and extend ActionBarActivity in my code,
however, this is what showed up
which is not what it is supposed to be
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
Any Help?
I have the same problem. I followed this step to solved it, in Android Studio - Tools -> Android -> Sync Project with Gradle Files.
Edit:
Sorry, I forgot add this:
After Sync Project with Gradle Files follow this steps:
Right mouse click for your project and select Open Module Settings
After that, select dependencies tab
In the end - selec your library:
This should work.

Categories

Resources