Hi I have found this github project:
https://github.com/ManuelPeinado/FadingActionBar
I have tried to import "samples-stock" and "library" into eclipse. Then I assign "library" as a library and add it in "samples-stock".
How would you make it work? I dont understand the authors instructions:
The library is pushed to Maven Central as a AAR, so you just need to add the following dependency to your build.gradle.
Thanks
Does your project, in which you want to use this lib, uses Gradle as build system?
If so, add dependency to build.gradle, as author suggests:
dependencies {
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
}
Else, I believe Android Studio is Intellij IDEA Community Edition, just with android plugin, thus you should be able to add dependency from "Maven" in Libraries. Just copy & paste the
"com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2"
line to the window which opens.
In eclipse:
File->Import->Existing android code into workspace and import library from disk drive.
If you want to run samples that are present in that library you can run them as "Android Application", like any other project.
If you want to use it in your project:
Right click on your project -> Properties -> Android -> Add(select that library) and you are good to go.
Related
I want to add DonwloadProvider library to my android studio project but it doesn`t have any compile dependencies.
so therefore I searched so much but did not find any related answer
please anyone help me with this it is very important for me
Download the Project from the github and add it under your project folder
Do the following steps
1. Goto File -> New -> Import Module.
2. Source Directory -> Browse the project path.
3. Specify the Module Name – it is used for internal project reference.
4. Let Android Studio build the project.
Open build.gradle (Module:app) file.
References:
How to add library projects
I am trying to import an android project created in eclipse into android studio. This main project also refers to another library project in the same eclipse workspace. The folder structure is like this:
workspace\app1
workspace\lib1
When I import the main project into android studio, the library project is automatically imported as a sub-project (or shall we call it a module) within the main project. That's not what I want. The library project is shared by multiple apps I am maintaining. It should sit in parallel with other app projects in terms of folder structure. I wouldn't want it to go understand any particular app project.
Please help explain how I can make the library project stand its own and refer to the library project from other app projects in android project. I am fairly new to the gradle build system. So detailed instructions would be highly appreciated. Thanks a lot!
Since you are importing in android studio, I assume you are moving to gradle build system. In your case , I think, it would be best to have a separate AS project for library. Use that project to generate a jar file and then import that jar using gradle build script in each project you want to use it.
If you are sharing the same library across multiple, you can configure them as separate AS project and have "aar" file as output. (In your gradle you put>> apply plugin: 'android-library'). You then define them as dependency in your gradle file. (either through maven repo or putting it in your libs directory and defining it in your dependencies section). You can find more info at http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-projects
You can use version control tool such as git to synchronize the library project in every main project. But you need to use a version control tool to manage all your projects first.
Read here on "AS Modules"
review 57.1.2 on "common behavior"
Take a look at a project built on AS pattern of modules as libs used in eclipse (gradle.settings) pictured
all the includes are modules
maybe you can rethink the idea of how to get AS to work for you in reusing code....
I want to use google map in my application
I Have Added google-play-services_lib as project and set as library , And then i have added google-play-services_lib to my project
if i check again it marked as red icon
Can you please help to resolve this
I am assuming you haven't imported the library in correct way.In order to work, the library project and your main project need to be in the same workspace. While importing google-play-services to eclipse make sure you have checked Copy Projects into workspace option as shown in the below image,
Else you can also copy paste the google-play-services library project into your workspace and then import it from there.
You no longer need to add the Google Play Service library in your project. Adding
compile 'com.google.android.gms:play-services:4.3.23'
under dependencies does the job.
Edit:
If you don't know how to add dependencies in Eclipse, take a look here.
In Android Studio (or any other Gradle based IDE), just open build.gradle and add the above line between dependencies brackets.
I have a setup of android project on eclipse and I want to migrate to Android Studio. So, I have android-support-v4.jar that I use for my main project and my Facebook lib-project.
I guess I have to exclude lib-projects as a folder in my main module (lets call the main module Jack). Jack has dependancy on the facebook lib-project.
How should I define the android-support-v4.jar as a separate library and use it in both projects? Or should I just use directly the jar files and leave them in both Jack's libs folder and Facebook libs folder?
If the first option should be done, will ant clean release still work (with the build.xml android generated file)?
In Android Studio, builds are done with Gradle now. Gradle is different. With gradle, you tell your project which jar's you need, and it will connect to a server and download them if it doesn't already have them when you compile your apk.
A few things to note:
When you install Android Studio, it has it's own Android sdk directory. You have to download everything from the sdk downloader (from inside the Android Studio App) again. Don't bother trying to switch the sdk download path to your current one. You will only encounter bugs (Or at least I did).
So your question is worded very confusingly. It sounds like you have a main module, and then you have a library module, and the library module uses the support library.
You'll need to set it up so the main module has a dependency on your library module. From there, you'll need to go into your library module's gradle file and tell it that you want to include the android support library
dependencies {
compile 'com.android.support:appcompat-v7:19.0.0'
}
The support library is a little weird in gradle. Gradle normally would download the dependencies you need. However, android studio requires that you have the support library installed through their sdk downloader (top-right group of icons in android studio. The download icon).
After you get all your dependencies entered into your gradle file, you'll then need to go to Tools -> Android -> Sync gradle files with project. From there compile errors should go away, and you should be able to run the project.
Best of luck. By the way, Here is the documentation on Gradle on the android website. I find myself having to go to it A LOT, especially when I made the switch from Eclipse to Android Studio. This + Various tutorials I found as needed via google. http://tools.android.com/tech-docs/new-build-system/user-guide
EDIT: This link might also be helpful. Google has some steps for switching from eclipse to Android Studio: http://developer.android.com/sdk/installing/migrate.html That with some of the stuff above may prove helpful.
While I haven't tried this myself, I suggest you use the recommended migration steps provided by Google in this article.
Before you do that, though, make sure that you either:
Check that both support libraries on the main project and dependencies have the same version (Eclipse will complain about it during build time, and will likely cause problems during conversion to Gradle script.); OR,
Uncheck the "Android Private Libraries" entry on the Order and Export tab of the dependency project's build settings.
If the migration process described doesn't work smoothly for you, you can always call the Ant build script from within the Gradle script, as described here.
The Android Studio uses only Gradle, but you can export Android ant project from eclipse.
To do that go to File -> import project usually next, next, next... works.
If not go to project setting Shift + Ctrl + Alt + S and under modules -> PROJECT_NAME -> Dependencies you can add your support library.
To add a Facebook library you must add it as another module to your project.
If you still want to use Ant there is another option: Use Intellij IDEA which support Ant.
Can anybody tell How to add java project as library in android project using eclipse?
As is explained in the documentation, you can go into project properties (e.g., Project > Properties from the Eclipse main menu), go into the Android section of the properties dialog, and use the Add... button in the Library group box to pick an Android library project from the available libraries in your workspace.
Maybe take a look here..
Import source java project in Android project
Or you can create a jar file from your project and import it as external jar as described here
hope it helps
For Library Project:
Rightclick->Properties->Android-> tick Is Library
For project in need of import:
Rightclick->Properties->Android->Add...->Library Project