Cannot evaluate module libs:configuration with name 'default' not found - android

Good morning every body ,Please i have an error at my android application when i try to import file.jar .. I really tried a lot of solution but the error is the same.
Can u help me please to solve the problem ! thank you

Add your library folder in your root location of your project and copy all the library files there. For ex YourProject/yourlibrary then sync it and after that you need to mention that library in settings.gradle e.g include ':yourlibrary' one more thing you need to do is to add this line in build.gradle(Module app)
compile files('libs/yourlibrary')
here is the second way to do this just Go->File in android studio after that find project structure then click on Dependencies -> click on green "+" icon then click on File Dependencies select your required file from your libs or library folder and click ok.

Related

Parse UI not being found when syncing gradle

screenshot of my problem
Hi guys!
There has been a recent problem regarding the ability to import the ParseImageView class in Android Studio and there is currently only one solution: Unable to import ParseImageView - Android.
When trying this solution, it asks to download a ParseUI-Widget file from github and then import that project into my current project and then finally add a dependency for the ParseUI in the build.gradle. When attempting to sync the gradle, the error in the screenshot keeps on popping up no matter where I place the ParseUI-Widget file in the project file directory.
Please Help!
Thanks
Few things to check.
Make sure that this is the content you have inside your ParseUI-Widget.
Move your ParseUI-Widget up one directory. This way it is the same level as app
You also need to edit your settings.gradle. Your settings gradle likely looks like this:
include ':app'
Edit it to look like this:
include ':app', ':ParseUI-Widget'
You have two options:
You currently have ParseUI-Widget within the app/ directory. So you should be including it in your top-level settings.gradle file as :app:ParseUI-Widget, and within your build.gradle as compile project(':app:ParseUI-Widget')
You can also move the entire app/ParseUI-Widget directory one directory up, so that it's in the same directory, side by side with your app/ directory.
From your screenshot, it seems you haven't imported the ParseUI-Widget module. Rather you just cloned the project from github and pasted it in your project directory structure.
What you have to do is,
go in your android studio project structure view,
right click and under new,
click on new module and then
import the ParseUI-Widget as module.
Then those dependencies are in build. gradle will work fine.

Project already contains module with this name -- Android Studio

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.

How to import external library in android studio?

I struggle to import library 'PageSlidingTapStrip'(https://github.com/astuetz/PagerSlidingTabStrip).
I found this question(How to import eclipse library project from github to android studio project?), and I follow this solution.
cf)I'm using win 8.1 , android studio version 0.3.6
First, build new project like this condition.
Second, go to File -> New Module click, create new module as android library and make condition like this.( Unchecked create custom launcher icon, activity )
And this part I got a first question. Which version should I choice version about 'Minimum required SDK' , 'Target SDK', 'Compile with'? Just Follow project version? (image show default value when I create this window first.)
Anyway, I progress under condition ' Minimum required SDK : API 9 / Target SDK : API 19 / Compile with : API 19 '
Third, delete files under 'Project/PageSlidingTabStrip/src/main/' and copy folder&file under external library 'res', 'src', 'AndroidManifest.xml' and move into 'Project/PageSlidingTabStrip/src/main/' then renamed src to java.
And then project & folder become like this. (what I followed question as , told me copy and move file 'ic_launcer-web.png' apart from 'res', 'src', 'manifest' , but I can't find that file)
Fourth, go to 'File -> Project setting -> Module -> click project module -> '+' button -> select Module dependency' then apply.
After that, I face this error and cannot resolve R.
And I can't go next step, can't finish import library.
What should I do?
Is there any other solution?
Thanks for seeing long question. I hope to get a solution!
I also use the PagerSlidingTabStrip Project in my app and everything works fine.
I'm not sure if it's already possible to add a library project via the IDE (-> without any problems).
Please try to add the library project by editing the gradle files like this:
first delete your module PagerSlidingTabStrip
then create a folder in your root project directory (-> NewOne) named 'libs'
copy the complete folder 'library' of the PagerSlidingTabStrip project on git into 'libs'
rename the folder 'library' that you just copied to e.g. "PagerSlidingTabStripLibrary" (just to avoid confusion) -> after the renaming you should have the path: "NewOne/libs/PagerSlidingTabStripLibrary"
now add this library in your settings.gradle with the following command:
include ':libs:PagerSlidingTabStripLibrary'
go to your build.gradle file of your AppProject aps and add the following line to your 'dependencies':
compile project(':libs:PagerSlidingTabStripLibrary')
at least you have to sync your gradle files: Tools -> Android -> Sync Project with Gradle Files
Please try this. If you get errors please post the log file.
For update up to Android Studio 1.2.1.1
There are basically three types of dependencies which we have to add in project of android Studio
Add Normal Dependencies like Support files
Right click on project->open module settings
Select dependencies->Now press right "+" icon button ->Select
library Dependencies
Enter Name and Search
Select file and press ok button.
Add Git Hub Dependencies
Find the dependencies of git repository for example compile 'com.jakewharton:butterknife:6.1.0' from https://github.com/JakeWharton/butterknife
A. open build.gradle(module:app) file
B. Add lines compile 'com.jakewharton:butterknife:6.1.0'
OR
Follow as describe above in Normal Dependencies Step by just enter dependencies in search bar
Add Jar files Dependencies
Right click on project->open module settings
press left "+" icon (insert new Module) button -> Select import Jar or .AAR package->browse Jar file and finish
Now select dependencies-> press right "+" icon button ->Select module Dependencies->select jar files->press ok button.
For what it's worth I had this problem and eventually solved it by consistently using the same sdk version & build tools across projects.

Android Studio not showing modules in project structure

I am using Android studio and I want to add module to my project like
"action bar Sherlock" or jar files,
but when I opened the project structure there is no module or library in the menu :\
In intelij it's appearing:
So what's the problem? How can I add these modules in Android studio?
Update 19 March 2019
A new experience someone has just faced recently even though he/she did add a library module in app module, and include in Setting gradle as described below. One more thing worth trying is to make sure your app module and your library module have the same compileSdkVersion (which is in each its gradle)!
Please follow this link for more details.
Ref: Imported module in Android Studio can't find imported class
Original answer
Sometimes you use import module function, then the module does appear in Project mode but not in Android mode
So the thing works for me is to go to Setting gradle, add my module manually, and sync a gradle again:
First, create your Module. You can do that using the default Android Studio Module Wizard (File -> New -> New Module), select Android Library, give it a Name and a package name, and finish.
After that you will see that nothing happens. Open the side Gradle Projects Section (should be somewhere on the right panel)
You should see something like this:
Expand your module gradle and run the Run Configurations task.
After that refresh the content and refresh the project structure.
It should work now.
Do right mouse click on your project, then select 'Open Module Settings' - then you can add modules to your project..
Go to File->Project Structure-> Project Settings -> Modules.
Click on the green colored + and add new module. select Application module and set the content root to your project module.
Click next and then finish.
Reference
You need to add a gradle.settings file to your root project structure, after that when you "Open Module settings" you will the menu aligned to your gradle.settings. When importing a project to Android Studio, it doesn't create this file for you. Sometimes it's usually better to start a clean project and move your code there, it's usually easier to achieve.
This Might be help some:
To import module as library in your project.
File > New > Import Module
Select Valid path in Source Dir..
Tick on Import > Finish
Now Open Module setting:
Go to File > Project Structure > Modules
Modules > Dependency > click on Green Plus Sign.
Click on Module Dependency > locate module > and Implement your module.
if your module is not shown in "Choose Modules Window"
Follow the below step..
Open Settings.Gradle file
include ':app', 'Put your module name here' and sync project.
Follow Open Module Setting as above.
As for me issue was that the first line in the build.gradle file of the OpenCV library.
It was something like this:
apply plugin: 'com.android.application'
This refers to the fact that the imported OpenCV is an application and not a library. It exists for OpenCV above 4.1.0. So change it to:
Something like this:
apply plugin: 'com.android.library'.
You might get an error in ApplicationId, comment it out in the gradle file.
Open settings.gradle and add the module as below,
include ':app',':bottomnav'
here i have added my newly imported module ':bottomnav' separated with a comma. then Sync your project. your module will be visible to dependency.
Android Studio only displays those module, which are defined in the settings.gradle file of your application.
after defining the module in settings.gradle, you will be able to add the module as dependency of your application.
I had the same problem, after switching to a branch that did not have my module, then switching back.
Clean Project -> Rebuild Project did not work for me.
But File -> Invalidate caches/restart did work.
Check settings.gradle. You'll find this : include ':app'
Just add your own module name and it should look like this :
include ':app', ':yourModuleName'
Sync.
That's it.
Had similar issue when running version control on a project in Android Studio (0.4.2). When pulling it down to a new location and importing the modules, only the "Android SDK" were showing in the Project Structure.
I removed the .idea/ folder from the version control, by adding it to .gitignore file, and did a fresh pull and imported the modules. Now all the settings appeared correctly in the Project Settings and Platform Settings for the Project Structure.
Here's what I did to solve this problem
Close Android Studio
Quick Start -> Check out from Version Control
Please go to Module settings
and choose Modules from Project Settings
then you need to Select src and gen folders and marked them as Source folders by right-click on them and select Source
First You Have To Add Name Of Your Module In setting.gradle(Project Setting) File Like This..
include ':app', ':simple-crop-image-lib'
Then You Need To Compile This Module Into build.gradle(Module app) File Like This..
implementation project(':simple-crop-image-lib')
That's all for adding module now it will be appear in android section or project section as well.
If It's till did't appear rebuild or clean your project..
Although not similar to the question above,
In my case,
The module is not visible in the android tab,
I saw it in the project tab.
After deleting the .idea/workspace.xml file, (I guess there is a problem because the unloadlist list remains here?)
When I reopened the project, it worked fine.
Additionally,
When invalidate caches (clear VCS Log caches and indexes),
It shows up for new modules, not for previously deleted modules (this only worked when deleting workspace.xml).
If you moved the modules, modify your workspace.xml file and settings.gradle file to use the new paths of your module.
Otherwise you will need to try using the import module feature.
Make sure the directory name is lower case.
First and foremost, check that all the modules are listed in your settings.gradle file.
If they are not, add them.
If they are, change something/anything in the file so that the Sync Project prompt comes on. Sync and your project should compile fine; the modules you're looking for will appear in your project structure.
in my case somehow build.gradle file deleted under app i restore it

Module dependency not detected during compile in IntelliJ IDEA 11

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!

Categories

Resources