I just created my first project in Android Studio and now want to add a third party library (that is also built by gradle) to the project. How can this be done? What I've tried so far is:
FileNotFoundException: /Workspace/AndroidStudio/project/something-else (No such file or directory): /Workspace/AndroidStudio/project/something-else (No such file or directory)
Obviously the wrong approach to import a module as dependency. But how else should it be done? Any advice is appreciated, Thank you!
Launch Android Studio, and click File > New > Import Project. Locate your project directory, click the build. gradle file you created above to select it, and then click OK to import your project.
Click the dependency you want to add to your application. You can use Ctrl+click to select multiple non adjacent dependencies, or Shift+click to select multiple adjacent dependencies. Drop the dependencies to the Manual Dependencies folder of the application. Save the application.
I have also ran into same kind of issue. For me the problem is because i already imported the module. When you importing the module first time it will create a folder inside the project directory named which you entered on the importing window. So when i try to import it again using the same name it will produce the error "Project already contains module with this name". Because there is already a folder with the similar name is there. So to resolve this you need to first delete the folder which already imported from the project directory. And its is not the fine way to renaming the build.gradle.
I know the answer is too late. Hope it will help somebody.
Faced similar issue issue("Project already contains module with this name") while importing an existing android gradle project as a a new module.
Noting down How do I fixed it(may be helpful to you or somebody else).
Issue: When I import an existing android gradle project to my current android project, its shows "Project already contains module with this name". Yes, the "app" module is present in the current project the importing gradle project.
How to fix it:
Go to the build.gradle of your newly imported module and update the "apply plugin" from,
apply plugin: 'com.android.application'
to
apply plugin: 'com.android.library'
Also, if the newly imported module's build.gradle has the "applicationId", then remove it.Your application ID shall be the main "app" module's application id. Library projects cannot set applicationId. Note: If you have used the applicationId(package name) to start an activity or bind service at the imported project, you have to update it with the the application package name.
Go to the project structure, and import the module as a dependency. then clean project, rebuild. done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With