Questions tagged [android-library]

An Android library project is a development project that holds shared Android source code and resources. Other Android application projects can reference the library project and, at build time, include its compiled sources in their .apk files.

An Android library project is a development project that holds everything needed to build an app, including source code, resource files, and an Android manifest. However, instead of compiling into an APK that runs on a device, an Android library compiles into an Android Archive (AAR) file that can be used as a dependency for an Android app module.

Android Team started revamping the whole design of Android library project since SDK r14 and is going to move from source-based mechanism to compiled-code based library mechanism, in order to support distributing Android library project as a single self-contained jar file. More details in their official blog.

A library module is useful in the following situations:

  • When you're building multiple apps that use some of the same components, such as activities, services, or UI layouts.
  • When you're building an app that exists in multiple APK variations, such as a free and paid version and you need the same core components in both.

Useful links

1883 questions
0
votes
0 answers

Create android sdk for developers .. how to hide the sdk classes visibility from the developers !.. like facebook - uber sdk

Iam working on creating sdk for developer like uber .. My Questions is: how to control the classes visibility .. I need the developers that use this sdk to just only see the Entry Point Class .. not to see all the sdk classes with keep the…
Ahmed Garhy
  • 475
  • 3
  • 11
0
votes
1 answer

Can two realm modules have the same classes?

I'm making a library that uses realm to save data. I set up modules (one for the library and one for the app) and I'm using the realms with the different configs with the modules. Does the user have to know my RealmObject's names to avoid calling…
alessandro gaboardi
  • 889
  • 3
  • 11
  • 26
0
votes
0 answers

How to ask user for adding dependency in android?

I am building a Android library which contains some add-on features on top of support library, adding support library increases the library size, how can I ask the developer using my library to add the support library explicitly or use the one if…
Gurleen Sethi
  • 3,162
  • 6
  • 26
  • 48
0
votes
5 answers

error when adding support design

error when adding support design renderring problems occure then adding library , and using API 26 , and i already added maven in reporesetires and added dependencies but same problems. tryed to to clean and rebuild same problem. tryed to invalidate…
0
votes
0 answers

Android: Extend a library

I develop an android application, and I used an open source library called cacheword to handle it's password. Now I want to set another password for it, which I mean I want my app has two password! But I can't do it, because according to this…
Zeinab
  • 43
  • 10
0
votes
1 answer

How to import android library from GitHub to eclipse

How to add gradle library in android project. We download the project from github. https://github.com/michael-rapp/ChromeLikeTabSwitcher We follow these step but it showing the error. Import the library folder from above zip as Android project. It…
0
votes
1 answer

Android main package vs library module: who's app version data do I retain?

I was wondering where I should specify the versionCode/versionName in an Android library. Before I created the module, the app version data was stored in the manifest. Now I have two manifests, one for the main application (third-party) and one for…
deMouser
  • 369
  • 1
  • 2
  • 14
0
votes
1 answer

Correct way to use to create module that depend on an external JAR library

In this page: https://developer.android.com/studio/projects/android-library.html#Considerations It states that: You can develop a library module that depends on an external library. (for example, the Maps external library). In this case, the…
Suhaib
  • 2,031
  • 3
  • 24
  • 36
0
votes
1 answer

Activity inside library module starts but doesn't display layout

My code My main project public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // --------- 0 way View v =…
Suhaib
  • 2,031
  • 3
  • 24
  • 36
0
votes
1 answer

Auto import dependecies from my library

I created an android library that acts as a wrapper. I use some dependencies in the library notably Volley and Google Play Services. When I try to paste the .aar file in the project and compile it these libraries are not being imported and they…
Tyson
  • 747
  • 2
  • 6
  • 18
0
votes
0 answers

Android Creating Library doesn't work after being import

i have made a library in android using volley, Gson and Glide. and created a .aar file when trying to import in other project(which contains Gson or Volley or Glide) it doesn't work.. it gives multidex error.. i dont want this error to come.. why…
0
votes
1 answer

Can't use custom build annotation in Android Library Module

I am trying to build an Android Library for existing Java Library. In my Java library there is annotation called org.wso2.siddhi.annotation.Extension When I try to add this annotation to a class I get the following error. Error:Execution failed for…
chamathabeysinghe
  • 858
  • 2
  • 13
  • 34
0
votes
1 answer

Restrict method to accept resource resolved by ContextCompat

I have a model for which one of the setters is expecting a Color Resource but it is not to able use said resource directly without it being resolved (by making use of ContextCompat). Is there a way that I can annotate my method to indicate/restrict…
avluis
  • 317
  • 5
  • 18
0
votes
1 answer

What goes into AndroidManifest of a library project?

I have an Android library that contains an activity. Yet it does not appear to matter whether I include the activity in the element or not. As long as I put the full 'path' to the activity in my application that uses the library is done, I can run…
Brian Reinhold
  • 2,313
  • 3
  • 27
  • 46
0
votes
1 answer

Launch activity inside a library from an Android application

This is my first Android library that I'm working on. I had initially built it like a regular Android app. Later, I created a new module and transferred all the source code to the module from the main app. Now, I've successfully created an .aar file…
Vivek Malhotra
  • 751
  • 2
  • 7
  • 17