This question already has answers here:
error can not resolve symbol TabLayout and 'design
(4 answers)
Closed 4 years ago.
Using these three lines:
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.Toolbar;
I get the following error:
Cannot resolve symbol 'design'.
How do I solve this problem? Are there any files that I'm missing?
You need to include the library in your Gradle app's file:
compile 'com.android.support:design:26.0.1'
There is a link to help you include librarys in your project
You need to add the com.android.support:design library, following the instructions for adding artifacts from the Support Library to your project.
Had same issue with support-v4 library, when in Android Studio I had this issue, but everything worked fine in command line
For me nothing of below worked:
1. File - Invalidate Caches / Restart...
2. Aligning support versions with compile version
The only thing helped me is:
1. Close project
2. Remove all Andoroid Studio related files: .gradle, *.iml, .idea
3. Import project again
Try to this ..
add below dependecy into app level gradle file ..
implementation 'com.android.support:design:27.1.1'
import android.widget.Toolbar;
import android.support.design.widget.Snackbar;
import android.support.design.widget.FloatingActionButton;
Related
In my gradle.properties I have this:
android.useAndroidX=true
When I Make Project, I get BUILD SUCCESSFUL. From Android Studio, I go to Refactor > Migrate to AndroidX... I am getting 15 references in 9 files to be changed:
Reading https://medium.com/androiddevelopers/migrating-to-androidx-tip-tricks-and-guidance-88d5de238876, I see that the step 1 of the recommended approach to migrate is to Update to Support Library version 28. In order to do that, I want to know what Support Library version the code of my app is at. Where can I see that? In some of my .java files I have found the following:
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.content.ContextCompat;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.support.multidex.MultiDex;
In my app\build.gradle I have this: implementation 'com.android.support:multidex:1.0.3'.
Do any of the lines above reveals or helps to reveal the Support Library version that the code of my app is at? Thank you.
What it means is that they suggest upgrading all of the possible support libraries to 28.0.
Those are basically anything that starts with com.android.support:
e.g.:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
The recommendation there is so the migration in the AS will have to do minimal guessing on how to migrate it.
So to stricly answer your question, the version you use is the version you have in gradle.files.
In build.gradle:
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
In my code:
import com.facebook.AccessToken;
import com.facebook.AccessTokenTracker;
import com.facebook.login.LoginManager;
I don't think this was an issue before, but all of the sudden today it's saying "cannot resolve symbol" for all of the import statements and so lots of things in my code are now wrongly marked as errors, even though when I run my app it works fine. What could be causing this?
tools>android>sync project files with gradle files
Try this:
Ctrl+Shift+Alt+S->selectApp->Dependandies->select"+"->moduledependandies->choose facebooksdk
So I'd like to import the "apache commons ftp" libraries for use in my project. I got as far as the importing the modules, and am including a pic just to show that they're in there.
But when I try to use the import statements
(i.e.) import org.apache.commons.net.ftp.FTP;
they fail.
So am curious if I am missing a step, or am missing something.
Please add below dependency in your gradle:
// https://mvnrepository.com/artifact/commons-net/commons-net
compile group: 'commons-net', name: 'commons-net', version: '3.5'
For any dependency to import in Android Studio through gradle use below reference:
https://mvnrepository.com/
This will save your time from importing module and solving gradle errors :)
Thank You
I would recommand AndiGeeky's answer if you don't modify so you have a custom library.
Meanwhile if you really want to use the library as a module, you can add this line in your build.gradle in your module app
compile project(':NAME_OF_YOUR_MODULE') << should be commons-net-3.5
Hope that will help you :)
I am trying to import the library.
I added it to the gradle script
compile 'com.android.support:design:22.2.0'
If I open the project structure( control+shift+alt+s ) It is added on dependencies of the module. But If I try to write the import it doesnt appear.
There is a photo with the project dependencies, gradle script and the import now working
I just tryied to add a TextInputLayout on the xml file, eliminated the snackbar and tryied to compile it, After no error, it works, Now I can import the snackbar
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.