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
Related
I am building an Android app and am using Material3 Theme Builder. I am able to export my custom theme as a zip with Theme.kt. I add it to my folder and made sure to update my package name because Theme.kt defaults to com.example.ui.Theme . I am running into some import issues with material3. Here is the imports in my header.
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.material3.darkColorScheme
I also tried to add the latest version of com.google.android.material.material 1.8.0-alpha01
into my gradle file but it breaks some other imports in some of my other files like
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
Before I changed anything in my gradle file my implementation line looked like this.
implementation "androidx.compose.material:material:$compose_version"
I am compiling on SDK 32 and the newest version of Gradle and Android Studio Dolphin. Any suggestions on what I could do to properly import material3?
To use Compose M3 you should add this dependency in your build.gradle:
implementation "androidx.compose.material3:material3:$material3_version"
Currently the latest version is 1.0.0-beta03.
Then you have to import the classes in the material3 package, for example:
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
Finally:
com.google.android.material.material 1.8.0-alpha01
This dependency is the Material Components for Android and it is not related to Compose.
This is what ended up working for me.
dependencies {
implementation 'com.google.android.material:material:1.8.0-alpha01'
implementation "androidx.compose.material3:material3:1.0.0-beta03"
I added these to my build.gradle file.
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'm a new in Android develop and also a new in Android Studio, now I have trouble dealing with support library that is coded by Eclipse. What's the correct way to import it?
I'm using the newest Android Studio and the version of gradle is 2.2.1
here is the url of the SlidingMenu support library
it seems that I need to import another support library ActionBarSherlock
First, you need to include ActionBarSherlock into your project, you can do this by import the file aar that you find in this site:
http://gradleplease.appspot.com/
Then, search for actionbarsherlock and you will find this piece of code:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
}
Put this code into your build.gradle file (inside app folder). If the dependencies it's alreay there, just include the compile ... line.
The next step is add the SlidingMenu into your project, check into this repository the dependency for the project:
https://github.com/jzaccone/SlidingMenu-aar
Then add into build.gradle as same as above.
You can also clone the SlidingMenu into your project and import manually, It's up to you.
Remember to change all of your activities and fragments to extends the
SherlockActivity / SherlockFragment.
That library is abandoned anyway, but if you want to use it in AS with Gradle here's its repository version with instructions for easier import.
I am trying to use clustering in my application. However on the import statements I get 'the import com.google.maps cannot be resolved (clustering.Cluster).
Also, when using ClusterManager I get 'cannot be resolved to a type'.
The rest of the google play services are working fine.
Are you using Android Studio, or Eclipse? Might need to check your gradle file (Android Studio for example) to see if you have the library/module dependencies lined up. If you are using this library (https://github.com/googlemaps/android-maps-utils) for example, your gradle file should have something like :
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.3+'
}
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.