I am try to write a IntelliJ plugin that will automatically add dependency to android build.gradle file.
dependencies {
compile com.XXX.XX }
For example when we add Crashlytics plugin in android studio.
its adds a dependency in build.gradle file. I need the exact solution for my plugin. I refer the below link
How to add gradle dependency automatically
Kindly give more idea to implement this.
Related
I am unable select any external library in my project other than com.google libs from the 'Choose Dependency libraries' dialog in the android studio 3.01.
I am not sure of any missing gradle settings and this issue exists even in any new Android studio project. Any help in resolving this is appreciated.
Just add this in your build.gradle file-:
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
Simply add below code in build.gradle file.
dependencies {
compile 'com.squareup.retrofit2:retrofit:2.3.0'
}
And if you want add other third party library then visit it's doc section you find gradle dependecy for it.
Read more about add third library in Android Studio projects.
How to use/import library in Android Studio
I want to use this Material Design :
https://github.com/navasmdc/MaterialDesignLibrary
I have Imported it into my project and changed version numbers in build.gradle of it to versions of build.gradle of my app
Now there is a build error :
Error:(24, 13) Failed to resolve: com.nineoldandroids:library:2.4.+
I have searched and founded some solutions such as change 2.4.+ to 2.4.0 ! or this link, but they didn`t solve the problem
The question is :
When a project imported, what should be same in imported build.gradle versions and my app build.gradle versions ?!
My project compile in offline mode, Should I disable offline mode and let the Android Studio to download gradle files needed ?
As the link for the library says, do the following in the build.gradle. Copy the compile statement below in the dependencies tag. Your library name was wrong.
repositories {
jcenter()
}
dependencies {
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
}
You will find the dependencies in the build.gradle in the app folder not in the project folder.
You need to disable offline mode. After the library is imported you can go back to offline mode.
About the cannot resolve error:
nineoldandroid library is very old and now deprecated. I believe the material design library is using NineoldAndroid library. For some reason, it not able download this library. Why don't you add the nineoldandroid library first. If the material design library finds it then it may not try to download it.
I want to use this library in my Android Studio project https://github.com/SimonVT/android-numberpicker. I can't for the life of me figure out how to add it to my project. Can someone just outline how this would work? I've only ever added libraries that were contained in jar files.
In build.gradle, use:
dependencies {
compile group: 'net.simonvt', name: 'android-numberpicker-parent', version: '1.0.0'
}
If you are using new gradle build system (and you really should), just add
compile 'net.simonvt:android-numberpicker:1.0.0'
to your build.gradle's dependencies section.
I found a forked version of this library which can be imported from source as a module in Android Studio. It is available here:
https://github.com/heavyplayer/android-numberpicker
eg.
`dependencies {
compile 'me.grantland:autofittextview:0.2.+'
}`
Where do i add this and how to make it work? i am trying to incorporate autofit textview in android
Find the build.gradle for your project, add the compile statement to the existing lines in the dependencies section. Android Studio will prompt you to "Sync Gradle Project Files", which will trigger everything required to find the library. After the sync you'll be able to import and use the classes as required.
If you want to use this then you need to have an Build-Management Tool like Maven, Ant or Gradle. Then this Tool downloads the dependacys for you.
But if you dont have something like this then just add this file to the project:
http://repo.maven.apache.org/maven2/me/grantland/autofittextview/0.2.0/autofittextview-0.2.0-sources.jar
Official Spring for Android page mentions to add following dependency code.
dependencies {
compile 'org.springframework.android:spring-android:1.0.1.RELEASE'
}
which is latest version of build as of this time.(as per website)
I have added it in apps' build.gradle but I get an error as
Error:Failed to find: org.springframework.android:spring-android:1.0.1.RELEASE
What is the right way to do it?
I could add google play services as dependency in the same way.
Here is the correct dependency for the Rest Template module. I've corrected this on the Spring for Android project page. Thank you very much for pointing out this error.
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
}
You can find correct and lastest version on spring site. Under the Quick Start title.
http://projects.spring.io/spring-android/