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

Is there any library to simulate sensors in android?

I am making some application in android, and I want to use sensors. But when I use Sensor class, it says that I don't have any of them. My android version is 6.0 and API level 23 but it says I don't have ROTATION_VECTOR sensor for example. So I am…
Jon Doe
  • 31
  • 5
0
votes
0 answers

Couldnt find binary Calabash-Android when importing Android Library in ROBOT FRAMEWORK

Error observed: FAILED AndroidLibrary Initializing test library 'AndroidLibrary' with no argumen ts failed: Couldn't find binary calabash-android Traceback (most recent call last): File…
0
votes
1 answer

TabActivity in library project, android.R.id.tabhost not found error

I am trying to create template/BaseActivity class for other developers to use, as a part of framework. I extended my class with TabActivity, and my xml looks like this/
0
votes
1 answer

Show error when using method with older Api

I'm trying to make a library in which I want a method to be used only if it is above a certain API level. I want the type of error shown here under putStringSet() method I have used @TargetApi annotation but no success. Developer is still able to…
H D
  • 77
  • 2
  • 10
0
votes
0 answers

How to create Cordova Plugin Template?

I am a newbie in creating cordova plugin or apps. I have an android native library i.e. an aar file which I need to make a cordova plugin from. I have read many articles about creating such a folder structure as below: pluginFolder/ …
zeeali
  • 1,524
  • 20
  • 31
0
votes
1 answer

Failed to instantiate ChipsInput from MaterialChipsInput for Android

I'm getting this error just by adding MaterialChipsInput to my gradle file and building the project: /root/.gradle/caches/transforms-1/files-1.1/MaterialChipsInput-1.0.8.aar/9cf34e21c8b45d8b575032229b78596a/res/values/values.xml Error:(3, 5) error:…
0
votes
0 answers

Start activity whitin android library

I need to start activity within my library. For example, I have a button in main activity and I want to attach to this button a method from library. In this method, I want to start new activity. My problem is I can't pass any info about my app to…
Golden Panda
  • 83
  • 1
  • 5
0
votes
0 answers

Android library gradle: how to print out androidTest compile classpath for debugging

Android library gradle: how to print out androidTest compile classpath for debugging? e.g., apply plugin: 'com.android.library' dependencies { androidTestImplementation 'com.android.support:support-annotations:24.0.0' …
eastwater
  • 4,624
  • 9
  • 49
  • 118
0
votes
3 answers

android library crash on start MultiDex

I've built an android library ( a custom button of sorts ) and uploaded it to my JFrog Artifactory now i tried testing it in an example app (really simple one with default activity) . The sync went well and I added the Button to the xml layout ,…
yanivtwin
  • 617
  • 8
  • 32
0
votes
1 answer

How to implement a paging mechanism into a RecyclerView with a potentially big data source?

I am looking for a good way to implement a paging mechanism into my RecyclerView lists. I'm using an AsyncTaskLoader to populate and cache the data into the RecyclerView. public class HeadlinesListLoader extends AsyncTaskLoader> { …
0
votes
1 answer

Android Studio 3.0.1 failed to add android-library dependency to java-library module

I have following project structure: I want to add a data module dependency (data module is android-lib) into domain module (domain module is java-lib). When I've done this I got this messages: : Here is my domain\build.gradle file: apply plugin:…
whizzzkey
  • 926
  • 3
  • 21
  • 52
0
votes
1 answer

Using large amount of gifs, images, texts in android app

I am building an android app that will ask user what they want to see. Based on that I will provide gifs, images and texts(one lines) based on time duration they choose. This would be an offline app. I am confused about how I should proceed with…
0
votes
0 answers

How to Embed A Fragment in My Custom View

I am trying to create my first library, which will give a custom view PDF. I have defined it as styleable as follows:
Mehdi Haghgoo
  • 3,144
  • 7
  • 46
  • 91
0
votes
0 answers

Anyone able to successfully compile Yalintis's FlipViewPager?

I've gone mad compiling Yalintis's library from here I get error each and every time. The error is at, com.yalantis.dracoagain.FriendsActivity$FriendsAdapter.getPage(FriendsActivity.java:60)` and the line 60 of MainActivity is holder.infoPage =…
0
votes
0 answers

Android base library module implementation

We are currently updating the app code, and we are splitting the code into different library modules, which are used by one application module. The problem is that the app compiling time has increased exponentially and all of a sudden the 64k…