I'm trying to install the supertooltips library and I fail every time.
I followed many tutorials, but I ended up with
Error:Configuration with name 'default' not found.
Are all the folders and files in the zip necessary, or do I have to put a specific folder in my library folder "myproject/mylibs"? And when I try to add the library from file>new>import module or right click project > new > module > import Gradle project and choose the library; it says project already contains module with this name "app" folder.
I'm using the Android Studio 1.5.
Just add this to your dependencies in your Module:app build.gradle:
dependencies {
compile 'com.nhaarman.supertooltips:library:3.0.+'
}
Simply add that line and then just rebuild the project and the library will be added.
Related
I'm trying to add a Java library (Maven project) into my Android project as a submodule. I'm using Android Studio.
P.S: For the simplicity of this question, I'll use samplelib as my library name.
What I did is:
1- git submodule add https://www.github.com/samplelib.git
2- Added the dependencies in my Android project's settings.gradle and app level build.gradle file
In build.gradle (app)
implementation project(':samplelib')
In settings.gradle
include ':samplelib'
But it doesn't work. I'm getting errors like samplelib not found
I have tried this for android libraries before and it works but it's not working for Java libraries. Any suggestions?
I have my Android Studio project structured as follow:
/mysdk
-manifests
-java
-com.xxx.sdk
-ext-libs
-com.yyy.lib (not .jar but .java files instead)
-res
/app
-manifests
-java
-res
I can include com.yyy.lib.* inisde com.xxx.sdk and reference all the methods without any symbol resolution problem in Eclipse project.
But after I transfer my IDE from Eclipse to Android Studio and it tells me it cannot resolve the symbols/methods from com.yyy.lib inside com.xx.sdk (ex: com.xxx.sdk.Activty.java)
How can I fix this dependency problem in Android studio?
If you have no strong preference for the location of com.yyy.lib, just moving it into the parent (is it src/main/java? based on gradle convention) it will probably get picked up.
It appears the IDE is treating src/main/java (or whatever) as a source folder and your package paths aren't matching up with your directory structure
ext-libs.com.yyy.lib instead of com.yyy.lib
That's because Android Studio uses Gradle as its dependency manager, whereas Eclipse uses either Maven or Ant.
You can read more about managing dependencies with Gradle, here.
This answer explains how to add a dependency/library to Gradle in Android Studio.
In your project file browser:
Go to libs folder. and add your library if not present
and then in gradle: add compile files('libs/your_library') in dependencies and then Sync Gradle
I am in Android Studio and this is a NON GRADLE project.
I have installed google play services, and google repository through sdk manager. I have imported google-play-services_lib as a module and added the google-play-services.jar as a library.
Yet for some reason my android-maps-utils files can't find my play services references.
import com.google.android.gms.maps.model.LatLng
in com.google.maps.android.clustering.Cluster.java says model doesn't exist.I can see the file in the play services library inside my project as shown below:
So why can't this file pick it up?:
I had to add dependencies for my project and each of my 3rd party libraries.
In Android Studio File > Project Structure > Libraries > choose a library > on the bottom of the dialog there should be a + button. Click that and then add dependencies. I think I added them as libraries (whatever the second option was)
I am developing Android app with gradle project. My teammates use ADT, and I do Android Studio and I would like to try my best not to force limiting IDE for others.
As far as I know, ADT needs to have local dependencies (.jar or local lib).
Also if I have main project and local library which contains same local jar files, it cannot build with gradle due to "IllegalArgumentException: already added".
Settings below works fine with gradle and Android Studio but not for ADT, support v13 is not found.
Is there any way to make build works for gradle, Android Studio and ADT ?
Please let me know if you need more information.
My project setting looks like
settings.gradle
include: ':MyProj'
include: ':libs:PagerSlidingTabStrip'
build.gradle (MyProj's)
.....
dependencies {
compile 'com.android.support:support-v13:13.0.+'
compile project(':libs:PagerSlidingTabStrip')
}
.....
build.gradle (PagerSlidingTabStrip's)
.....
dependencies {
compile 'com.android.support:support-v13:13.0.+'
}
.....
You will have to do the following:
Make an Eclipse project for MyProject and libs/PagerSlidingTabStrip
In MyProj, create a libs folder and dump in it both support-v13 and support-v4.
Do NOT change build.gradle to dep on the content of libs/ or you'll have a duplicate class file issue.
This is manageable if you have only one lib project and few dependencies. If your setup become more complex it'll become impossible to manage (hopefully by then we have Gradle support in Eclipse)
I created a fresh project in Android Studio which uses external library (JAR). I put this in modules's build.gradle:
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/mylib.jar')
}
But, when using Android Studio editor, it says there are some errors in my code and marks imports and variables (which use this library). It doesn't build properly saying that it cannot find one or another class. However, when I go to project's directory in terminal and execute gradlew manually, it builds APK and it (the APK) install and works just fine.
What am I missing? Is there any another setting in my project which is used for library detection?
Android Studio currently does not automatically sync your Gradle build files with your Android Studio (.iml) files. However, version 0.1.3 added a new sync button to the toolbar that will do this manually.
It's mentioned in the second bullet point of this blog post.
There were a lot of fixes in the Gradle project import and build
areas. There is now a "sync" button in the toolbar which will reimport
the Gradle project state into your Android Studio project. Use this
after editing your Gradle files, for example to add a library. In the
future we will more automatically handle state syncing, but for now
this is the simplest way to keep the IDE up to date with project
structure changes made to the Gradle files.