I had successfully imported a Module in my Application project in Android Studio.
Then I deleted or removed the module by following the below link:
How to delete a module in Android Studio
I also removed the project module from the dependencies of my build.gradle(app) file.
Now, When I need to again include the same module project in my Andorid Application, it doesn't allows me, and gives the Project already contains module with the same name error.
I had check in my Project, Package, Android Structure but the project module which i need to Import and add as a Module Project is not there but still it say it already exist.
Can anyone help me to overcome this issue.??
If somebody faces this issue, except removing the Folder containing the old module also remove from the settings.gradle file the line corresponding to the old module: include ':youroldmodule'. If you dont remove that line manually, 2 modules with the same name will appear when trying to add module dependency.
Switch to the Project View. Then open .idea/modules.xml. Find and delete the line that corresponds to the module. Then Invalidate Caches and Restart. That's it.
I solved the problem through this way:
Open Module Settings(Mac: command + down; Windows: F4) and delete the module.
Delete the module folder on the disk. You will find it at ~/AndroidStdioProjects/YourApplicationName/ModuleName.
Import the Module.
I have encountered this.
And I deleted the folder which below my project with the module name I set before, then I can import a module with same name again.
Hope this helps you.
The project view on the left hand side, doesn't show 'everything' your project contains. You can switch the view from the drop-down menu, which is defaulted to 'Android' and change it to 'Project Files', which will probably show you where the problematic reference to the Module remains.
Alternatively, just check on disk where your project is located. I found references in the main project folder.
You can't import a module if you've put the code for the module in the place it will end up being copied to. I had the module source code placed in the project root folder and it failed to import with the above message. If you move the code away somewhere, on import Android Studio will copy the code in.
If you still see the error after removing the code from settings.gradle and the app gradle file, check the following file and remove any entries with the module name you are trying to remove.
./.idea/modules.xml
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
Remove compile project(':module_name') from build.gradle under app folder
then remove module folder under your Project Folder
then remove your module name entry from settings.gradle
This worked for me:
In app/build.gradle, remove this line from dependencies {:
implementation project(':library')
In settings.gradle, change
include ':app', ':library'
to
include ':app'
Then you can import the library. Be sure to put the lines back into the gradle files you took out above.
Those who are still seeing this issue and have already removed the module from settings.gradle file but still sees that Module already present while importing it again, This is what I did:
1.) Switch to Project mode in Android studio for your project
2.) Once switching it to Android mode, delete that module manually by clicking right click on it.
And Hope it works for you now.
I am Not Sure but I hope it's Help you.
Step 1:
Pressed Alt + 1 for get Focus of your App.
Step 2:
Now Pressed F4 for open Module structure of Project
Step 3
Now Select Dependencies and Remove All Extra dependencies of your project.
than Pressed OK.
and Resync gradle.
I hope you are clear with my solution.
Best Luck
I had this problem when I was trying to add junit 4.12 to my project.First of all I delete old junit codes in dependencies of my build.gradle(app) file manually.Next I deleted the old junit.jar from my library with deleting libs folder and then create new libs folder directory in my app for add library.and for the end.......I find the old junit FILE near the end of project view after gradle folder....you can see in this image......and I deleted it.now I can add new module very easy and without same name error.sorry for bad english!!
look this image for last order
I solved this by removing the existing module from the project structure, then renaming the folder. It finally worked when I removed the folder, ran a sync, then re-added the folder and attempted to import.
In one condition if you have copy a folder like this
rootProject/module1
if you import module android studio will find if you have same name folder.
if you have it is not import android studio will tell you you have contains this module ,you just add this in setting.gradle
like
include ':modlue1'
If shows this error after deleting the module from project structure then, select Project view of our project in android studio and then explore and the there will be the folder of module that we imported, right click on that and Delete it and rebuild the app.
If any of the above answers worked for you and you are sure that your branch is clean then close your Android Studio, browse to the root of your project and delete .idea folder. Then re-launch Android studio and run your project.
I had same issue, initially created a module, then removed it from settings.gradle and finally the fix was to ACTUALLY remove ALL folders related to that module, those won't be visible in the ANDROID view, hence change to project view and remove all related or browse using an external tool and remove all folders
For me, there was still a reference to the old module in my project's /.idea/gradle.xml file:
<option value="$PROJECT_DIR$/mymodule" />
I just deleted that line then re-synced with gradle and the error went away.
I'm using IntelliJ/Android Studio with Ant build (not Gradle at the moment), and am trying to use android-support-v7-cardview.jar but I continue to get
android.view.InflateException: Binary XML file line #19: Error inflating class android.support.v7.widget.CardView
java.lang.NoClassDefFoundError: android.support.v7.cardview.R$styleable
I am not using m2repository with the aar file, but am using the cardview at location
sdk/extras/android/support/v7
I have gotten it to work by using the classes from the jar in my own project, but it requires API 21 (5.0) which I don't want to use yet. I am trying to use the jar file in the libs folder and res files from
sdk/extras/android/support/v7/cardview/res
I have added the lib file and res files to my own project, but still get the error messages above. What should I do?
I had the exact same problem after adding compile 'com.android.support:cardview-v7:23.2.1' to build.gradle's dependencies to use the CardView, however after cleaning the project (Build > Clean Project) everything worked like magic.
Hi this might be helpful, this worked for me. (for intellij users)
click in your project,
right click -> open Module Settings (f4)
import cardview from \sdk\extras\android\support\v7\
add .jar file to cardview module
click on your project and give module dependency to cardview
now, click (+) button on cardview -> android -> at top you will see a check box (library module), enable it.
click ok and close your settings dialog.
rebuild your project and run it.
I think you have to import it as an Android library project, then the ressources should be found correctly. I also tried first to import only the jar which didn't work, so I did it this way:
The project for the CardView is located in your Android SDK folder: Android\android-sdk\extras\android\support\v7\cardview
In Eclipse use "Import" and select "Existing Android Code Into Workspace" and import the CardView project
Go to Properties->Android of the new project, mark it as a library project and then Link it as a library project in your own project where the CardView can not be found
That should do it
I didn't figure out the error really but I just commented out the stuff that uses Android 5.0 in the source code of the library and it works fine. I didn't want to use a minSdk of Android 5.0.
If you are using Android Studio then its quick easier, Please add compile 'com.android.support:cardview-v7:21.+' in dependencies in build.gradle.
dependencies {
compile 'com.android.support:cardview-v7:21.+'
}
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 want to know how to import a custom library into my Android/Java program. I want to develop with AndEngine but I don't know how to import libraries manually. :P
Try to use Maven for create android app. Install with maven your lib and add it as dependency in pom.xml
then try to build it with maven.
Try this,
Add the Lib folder on your project. On that folder you should placed your jar files.
After that, Right click on your project and choose the buildpath from appeared menu. There's you can see,
libraries tab->Add Jars->please goes to your project Lib folder(created by you)->jar files.
I am developing an Android app and I'm trying to include GraphView to plot some graphs.
It is required to include it as a module dependency. After I do that, the IntelliJ IDE properly detects the packages and I can import them, but compiler throws errors when trying to compile:
package com.jjoe64.graphview.GraphView does not exist
cannot find symbol class GraphView
etc.
I followed this guide to include it: http://wiki.jetbrains.net/intellij/Sharing_and_re-using_Android_resources_through_library_projects
If it still occures to anyone , for me the reason was that the module's Android class libarary source folder was not marked as 'Sources' directory .
Simply click on the sources folder and choose mark directory as --> source folder.
After that instead of compile , choose 'make' , and then it will start working for you.
Best of luck with that annoying bug !
I had the same problem and this is how I solved it:
I was using Gradle so I right-clicked on the build.gradle.kts (it may just be build.gradle in your case) and clicked on "Import Gradle project" and everything worked again!