I have created an android library and published it in Jitpack.
Currently, my build is getting success in Jitpack. but when I add the implementation URL in my project build Gradle gets success but when I try to use library classes it does not get resolved
In the external library tab located in the project structure, it does not have the library which I have implemented so might be .jar file is not getting generated.
Help me If you have any solution or any way to identify this issue.
If I understand correctly you say that the gradle build or 'project sync' after a change in the gradle files works fine. But you cannot use any of the code from your library.
Can you verify that your library is loaded in the External Libraries?
It would be something with your repository name in it and ends with '#aar' (eg. com.github.nickname:libraryname:version#aar)
If you cannot find it, please check if your library module build.gradle has the line below somewhere at the top of the file.
apply plugin: 'com.android.library'
The issue was the Repository was private so we need to provide an authentication token. The reference link is given below
https://jitpack.io/docs/PRIVATE/
Related
I had a usecase so I have added retrofit library to use it locally in libs folder
You can see the package structure and error in the image below when trying to import Timber android libary.
In the app/build.gradle file, I have added dependency:
implementation 'com.jakewharton.timber:timber:4.7.1'
In the libs/retrofit/build.gradle file, there also I added dependency:
// I also tried using api instead of implementation
implementation 'com.jakewharton.timber:timber:4.7.1'
Now, I synced, did invalidate cache and restart, clean, rebuild project.
Then tried to use Timber.d("some log") call in one of the files in libs/retrofit directory.
It resulted in error:
Add library: 'Gradle com.jakewharton.timber:timber:4.7.1#aar' to Classpath
Note, the Timber.d("other log") works fine in one of the files in app directory, example app/MainActivity.kt
What I am doing wrong?
Also, to note Retrofit code works perfectly fine in app module. The issue is using a Timber logging library is not working in any of the modules in libs
In my opinion, the answer lies in the question asked in this thread itself.
What happened, is that when I went through this situation myself, I saw this thread in the Google Search results.
After adding the dependency, for example:-
implementation 'com.jakewharton.timber:timber:4.7.1'
and thereafter syncing, I saw that it was merely a page refresh issue.
That is I switched to another source file which was opened in another tab and came back to this in which the following code was issued (the place of the aforesaid error):-
Timber.tag(...).e(...)
Timber usage.
Timber is packaged as an AAR file, that means it can only be used in android modules of your project.
The solution would be to convert your kotlin module to an android module by applying the plugins below in your build.gradle file of that module
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
I am new to maptiler mapbox development , I download app from maptiler. now I am trying to build that app in to my android studio. but there are some errors. I am following it's ReadMe file . I put dependency MapboxGLAndroidSDK.aar in to lib and also apply mapbox public token and secret token at appropriate place as per ReadMe steps . but still I can't run app due to following error:
NoSuchMethodError: No virtual Method setSkuId(Ljava/lang/string;)V in class Lcom/mapbox/android/telemetry/AppUserTurnstile; or its super class
these are my mapbox dependencies:
com.mapbox.mapboxsdk:mapbox-core:4.3.0
com.mapbox.mapboxsdk:mapbox-services:4.3.0
com.mapbox.mapboxsdk:mapbox-geojson:4.3.0
com.mapbox.mapboxsdk:mapbox-android-telemetry:4.3.0
com.mapbox.mapboxsdk:mapbox-android-gestures:0.4.0
these all are prebuild dependencies now I am working with offline mode so if I have to apply more dependency I have to Downoload jar/aar for it. please suggest me some way to solve these error and successful run .Thanks
finally I found a way to run my project.
the conclusion is Mapbox updated it all library and split some. So I have to download all (.aar)Libraries from Maven repository and add it to my projects as library dependency to resolve issue regarding Mapbox library.
recently I updated following library with latest version .aar file:
mapbox-android-sdk
mapbox-sdk-services
mapbox-sdk-turf
mapbox-android-telemetry
mapbox-sdk-geojson
mapbox-android-core
mapbox-android-gestures
If you have internet connectivity you can directly upgrade all the library.
otherwise you can download from this link
I am trying to publish an Android library written in Kotlin as an AAR on Bintray to distribute it. I have already configured the whole project following various resources that I found online, and the publishing via bintrayUpload goes smoothly. Here's my build.gradle.kts.
However, when I import the library in another project, I can reference all the classes correctly but:
My library depends on RxJava 3, but that (and other dependencies) are not automatically downloading when importing my library in Gradle, resulting in Android Studio complaining about all the Rx classes.
I can't see the sources and the JavaDoc.
On Bintray, everything looks normal: I can see two JAR files (-Javadoc and -sources`), one AAR, and the usual POM file. I've inspected all of them, and they contain everything I'm expecting, including the dependencies in the POM file.
You can inspect the full source code here and the Bintray artifact here.
What am I doing wrong?
I had the same problem with maven-publish plugin. Sources were uploaded to maven repository but could not be downloaded together with aar. Sources were not included in .module.
I have found this plugin: https://plugins.gradle.org/plugin/xyz.tynn.android.sources - with this, sources are included in .module and are automatically downloaded together with aar.
This plugin doens't require any extra tasks for generating sources neither adding extra artifacts.
To use it all what has to be done is apply plugin: "xyz.tynn.android.sources" and publication configured according to official Android documentation
https://developer.android.com/studio/build/maven-publish-plugin
There is also plugin for JavaDoc https://github.com/tynn-xyz/BuildSrc/blob/master/README.md
I'm trying to create an Android library for two days already.
Realy need your help.
I have an existing App which I want to do as a Library.
According to Android developers documentation:
f you have an existing app module with all the code you want to reuse,
you can turn it into a library module as follows:
Open the module-level build.gradle file. Delete the line for the
applicationId. Only an Android app module can define this. At the top
of the file, you should see the following: apply plugin:
'com.android.application' Change it to the following: apply plugin:
'com.android.library'
I have done this step.
The next step is saying:
When you want to build the AAR file, select the library module in the
Project window and then click Build > Build APK.
I don't really understand how to build the AAR file.
Also in my library, I have others dependencies which I need to be in my Library.
I tried a lot of suggestions in StackOverflow but didn't find the answer.
Unfortunately, I didn't find a good example of creating an Android Library with dependencies.
I don't really understand how to build the AAR file
Just compile the library or use ./gradlew build.
The output will be stored under the library's subdirectory under build/outputs/aar.
I have others dependencies which I need to be in my Library.
The aar file doesn't contain the transitive dependencies.
I suggest you publishing your library into a public or private maven repository.
I don't understand how to add a library in my new project.
https://github.com/txusballesteros/bubbles-for-android
I saw similar posts but I don't get the library in my project.
Error:Configuration with name 'default' not found.
And when I add the library can I change the original source code and can I use it because I read about the same License ?
Please help me, I was trying many methods and I failed.
Locate your build.gradle file:
Go to android view (easiest this way)
Locate Gradle Scripts folder:
Locate your correct build.gradle file (watch it, there are 2 of those who look similar):
Add the this statement (compile 'com.txusballesteros:bubbles:1.2.1') according to picture:
Good to go
Add the library dependency in your app level build.gradle file(not project level). you don't need to download any library file just add this dependency and sync the project
dependencies {
...
compile 'com.txusballesteros:bubbles:1.2.1'
}
Add following to your Build.Gradle under dependency block and then sync. project. Now you can use that library methods in your code.
compile 'com.txusballesteros:bubbles:1.2.1'