Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import library project into Android Studio project

I'm writing a library project to create a component that's going to be used in some, if not all, of our projects. I wanted to test how it's going so far, but I can't import the library project into my other project.

So, I created my library project called SplashScreen with Android Studio. Now I've created the project SplashScreenDemo with an Activity that should use the component I wrote in the library project. But the import wizard doesn't let me choose the project and all the info I find online is to import into Android Studio your old Eclipse library project, but in my problem Eclipse isn't involved at all.

So far I've tried:

  • Right click on project root > New > Module > Import Existing Project
  • File > Import Project
  • File > Import Module

This is the window (and that's the path to my library project):

wizard window

I've tried several paths, none of them working:

  • /Users/dgc/AndroidStudioProjects/SplashScreen
  • /Users/dgc/AndroidStudioProjects/SplashScreen/SplashScreen.iml
  • /Users/dgc/AndroidStudioProjects/SplashScreen/build.gradle
  • /Users/dgc/AndroidStudioProjects/SplashScreen/app
  • /Users/dgc/AndroidStudioProjects/SplashScreen/app/app.iml
  • /Users/dgc/AndroidStudioProjects/SplashScreen/app/build.gradle

Any ideas? Am I missing something?

P.S.: Versions:

  • Android Studio 0.6.1
  • gradle 1.10
  • Android plugin 0.11.+
like image 458
Daniel Hernández Alcojor Avatar asked Dec 07 '25 23:12

Daniel Hernández Alcojor


1 Answers

I think what's happening is that you're trying to import a module that has the same name as an existing module and it's not giving you any indication of what's wrong. Actually, if you enter just the path to the parent project so it will show you a list of modules you can import, and those modules can't be selected if you hover over one, it will show you the error message in a tooltip:

enter image description here

Obviously that's not very helpful, and I've filed a bug asking for improvements:

https://code.google.com/p/android/issues/detail?id=71942

To work around it, you'll have to rename either the module you're trying to import or the module in your project. To do that you can right-click on it in project view, choose Refactor > Rename > Rename directory.

like image 77
Scott Barta Avatar answered Dec 09 '25 14:12

Scott Barta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!