How to import eclipse library project from github to android studio project?
If you're importing a library as source code into a Gradle-based project, then at the moment there's no super-easy way to do it (sorry, it's on the to-do list, see https://code.google.com/p/android/issues/detail?id=62122) so you'll have to author your own build file for the library. Actually, it might be easier to use the New Module wizard to set up the build file and directory structure, then you can trim it down and copy the files over. This set of steps should get you up and running. It seems like a lot of steps but it should hopefully go pretty quick.
- From the File menu, choose New Module...
- From the wizard that comes up, choose Android Library
- From the next page of the wizard, give it the module name HoloCircularProgressBar, and uncheck the options for Create custom launcher icon and Create activity.
- Click Finish on the wizard.
It should add the new module to your project, so you'll end up with something like this:
- Delete everything inside the src/main folder.
- Now copy
AndroidManfiest.xml
,ic_launcher-web.png
,res
, andsrc
from the HoloCircularProgressBar source into thesrc/main
folder. - Rename the
src
folder that you just copied intosrc/main
tojava
. - The New Module wizard left some things in the
build.gradle
file in yourHoloCircularProgresBar
module/directory (make sure you're editing that one, not the one for your main app module) we don't need. Remove thedependencies
block and therelease
block.
At this point you should hopefully be able to build successfully. Now if you want to actually use the module:
- Go to File > Project Structure... > Modules > Your main module > Dependencies.
- Click on the + button to add a dependency, choose Module dependency, and select
HoloCircularProgressBar
from the list.
Now import
statements and usages of the library should work, and you should be good to go.
Import Eclipse Project from Github to Android Studio - Parse.com tutorial
You should add to your app build.gradle google play services dependencies:
compile 'com.google.android.gms:play-services:+'
This is my app build.gradle after importing project
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.parse.anywall"
minSdkVersion 11
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/Parse-1.6.0.jar')
}
How to import open source library as an external project into Android Studio?
File-->New-->import Module.
File -->Project Structure-->click on '+' Left Corner-->Module Dependency.
Import an eclipse android project with version control system into Android Studio
Here is the step by step solution to do it.
- Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp")
Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't
get triggered and android studio uses old import wizard. - Android Studio will create a copy of your project "MyApp_imported" with new directory structure.
- Copy your existing ".git" directory inside "MyApp_imported"
- Android Studio -> VCS -> Enable version control
This will make Android Studio use your existing repository for imported project. Though imported project has
different directory structure but git handles them pretty well.
You might want to also callgit add .
andgit add -u
in the root folder of the imported project to make sure all new files are added and existing file moves are detected by git. - Android Studio -> Changes
Review all files and commit. Git will automatically handle new directory structure and file history etc will not be lost. - Now you can share it on github/Bitbucket by
VCS-> Share it on GitHUb
Note:- For bitbucket you will have to install "Bitbucket plugin" for Android Studio.
Related Topics
How to Add a View Programmatically to Relativelayout
How to Set a Fragment Tag by Code
Gradle Sync Failed: Failed to Find Build Tools Revision 24.0.0 Rc1
Starting Activity Through Notification: Avoiding Duplicate Activities
Session 'App': Error Installing APK
Android Edittext Listener for Cursor Position Change
Trying to Remove Fragment from View Gives Me Nullpointerexception on Mnextanim
Add Viewpagerindicator to Android Studio
Install_Failed_Cpu_Abi_Incompatible on Device Using Intellij
Is Google-Services.JSON Safe from Hackers
Android: Wait on User Input from Dialog
Music Player Control in Notification
How to Fetch Data from a Web Server in an Android Application
How to Find Memory Leaks from Native Code in Android
Replace Fragment with Another Fragment Inside Viewpager
Android - Creating a New Activity in Eclipse
Converting from Glsurfaceview to Textureview (Via Gltextureview)