I am trying to use this ExtendedCalendarView from github: https://github.com/tyczj/ExtendedCalendarView but I am not clear on how to add this to my android studio project. I tried to create a libs folder in my project folder and then pulled to the libs folder. Then I tried to sync the project but it did not work.
As they not offer gradle support, you need to download their library, and import it in Android Studio.
Do to this :
Go to File -> Project Structure
Then click the green + icon on the upper-left of the new window that just popped.
Choose Phone and Tablet application, and "Import existing Eclipse ADT or Gradle project as a module".
Select the library folder (the ExtendedCalendarView folder containing the AndroidManifest.xml folder), click Ok Next and Finish.
Wait for gradle project to sync
Then click on your main project module (often called "app"), and click on the upper-RIGHT green + icon, choose module dependency and select the extendedCalendarView module we just created. Then click Ok.
Wait for gradle project to sync
And you're good to go, your library is imported.
But, the library does not compile, you will see this error :
Error:(11, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#icon value=(#mipmap/ic_launcher) from AndroidManifest.xml:11:9
is also present at XXXXXXXXXXXXXX:extendedCalendarView:unspecified:13:9 value=(#drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:8:5 to override
To fix it :
Add xmlns:tools="http://schemas.android.com/tools" to your AndroidManifest file, in the manifest element, next to your existing xmlns:android="http://schemas.android.com/apk/res/android"
Then add tools:replace="android:icon,android:theme" to your < application > element as the error message suggest.
Now the project compiles correctly !
Please ask me if you need any explanation or help.
Try cloning the library onto your computer then adding it as a module in Android Studio. Once you have completed that go to project settings and add the module as a dependency.
I am totally confused by this error message: Android library projects cannot be launched.
I carefully checked the build path and library, everything is "OK". And there is no error in Problems view. However, when I tried to run my application as an Android project, it failed and showed this message.
already i have set library in properties check. my build Path also all are fine. when run my application error message is coming.In my application i have added Google play service library
please tell me any suggestions.
Just uncheck the Is library from project properties.
go to project property file and Remove this line -
android:library=true;
just remove your library file and then goto the --- project > property > android > remove library > add new library > apply ... then
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
I need help with a project dependency issue in the Android SDK.
I have the following projects:
"Sync" (a Java only project)
"Agonis" (an Android Library project)
"Dragonis" (an Android application project)
Agonis has a project dependency on Sync, and Dragonis has a project dependency on Agonis, like so:
Dragonis->Agonis->Sync
I have correctly used the Properties->Android->Library dialog to add Agonis as an Android Library. I have exported the Sync project in the Agonis build path setup:
http://i.stack.imgur.com/GsQIR.png
In the Dragonis project, I see both Agonis and Sync in the "Android Dependencies" virtual folder:
http://i.stack.imgur.com/EhH8L.png
From here, I would expect everything to just work, but it doesn't.
I can start the app, but as soon as I instantiate a type from the Agonis project (com.mob.agonis.AgonisServer), I get a NoClassDefFoundError. If it matters, the Agonis type I am trying to instantiate extends a type that is in the Sync project (com.mob.sync.Server).
I tried cleaning all the projects, and using Android Tools->Fix Project Properties on both Agonis and Dragonis to no avail.
Am I overlooking something?
Put the jar library in the folder libs and add it to the java built path.
Right click on the file -> Build Path -> Add to Build Path
Hope it helps.
I figured it out.
The Sync Java-only library was compiling to 1.7 Java byte code. Android only supports converting Java 1.6 byte code to DEX.
Scroll to the top of the console, kids.
You can solve this through the command line tool. You could create/update the Dragonis and Agonis android projects - one as an application and other as library. See http://developer.android.com/tools/projects/projects-cmdline.html
You can easily set up the dependency from D -> A using the command line tools as shown in section called referencing a library project. At this stage, a build of D automatically triggers a build of A.
Now modify the build.xml of A - to include a dependency on : build and copy Sync.jar at the pre-compile stage (look inside build.xml to find the placeholder). The build and copy tasks can be done by starting a sub ant process using subant. See http://ant.apache.org/manual/Tasks/subant.html
At this stage all your dependency work properly on command line if you trigger ant build. Now you can also use eclipse by importing the android project Dragonis from source.
From the project properties of "Sync" set the "Java Compiler"-> "JDK Complience" to 1.6. Rebuild and enjoy!
When I select the properties to my project then go to Android and add a new Library, the eclipse automatically create a Android Depencies that contains all my .jars.
It does not add the new project to the list of referenced packages. When I try to Run the application I got the error: Conversion to Dalvik format failed with error 1. When i realize I have the .jars that i added both in the Android Dependencies and my /gen.
When I delete de Android Depencies I got error in my classes, saying that i´m not referencing the specifics .jar... But I have them in my /gen past.
Any Ideia how to make the eclipse refer to just one .jar?
Library is a special android feature that allows you to use an apk or another android project where you would for example share some code. It's detailed here :
http://developer.android.com/guide/developing/projects/projects-eclipse.html
I think that what you want to achieve is just adding a jar as a dependency which can be done with Project > Properties > Java Build Path > Libraries Tabs > Add Jars / Add External Jars.
tl;dr :
Project > Properties > Java Build Path > Libraries != Project > Properties > Android > Library
I did these steps to make my app work with the lib-sources using adt 17
add "lib-sources-project" to workspace
import/general/existingProjectsIntoWorkspace
mark this "lib-sources-project" as android library
lib/Properties/Android/IsLibrary must be checked
Add lib to main app
app/buildpath/ConfigureBuildPath/Projects Add "lib-sources-project"
app/buildpath/ConfigureBuildPath/OrderAndExport set check for "lib-sources-project" so your lib will be included into the buildresult
app/Properties/Android/Library Add "lib-sources-project" to the list.
Note since adt 17 you can have resources in your "lib-sources-project". Android Lint will tell you what you have to change to make it work.
Hoever i haven't succeeded yet to include a jar with resources without adding "lib-sources-project" as described above.
Maybe somebode knows how to do this.