Cannot access inherited library - android

In my android library I am using ceddl4j library but when I build my library and try to add it's aar file in another Application, it is throwing error
Error:(75, 44) error: cannot access DigitalData
class file for nl.mirabeau.ceddl4j.DigitalData not found
Adding ceddl4j into my library with
compile group: 'nl.mirabeau', name: 'ceddl4j', version: '1.0.0'
I am surely missing something in build configuration of my library, can someone please guide.

Thanks to Grabriele for providing the information that aar file does not contain the nested dependencies, hence the option left is maven repo (public or private).

Related

Override java dependency in react native library

I need to use a react native library called #ihealth/ihealthlibrary-react-native
I added it to my project, but on build I get an error Could not find no.nordicsemi.android:dfu:1.6.1
This package version seems to be no longer available, so I would like to override the version in my react native app.
I added the following in MyProject/android/app/build.gradle
dependencies {
implementation("com.ihealth.ihealthlibrary:iHealthLibrary:1.5.1") {
exclude group:'no.nordicsemi.android:dfu:1.6.1'
}
implementation("no.nordicsemi.android:dfu:1.8.0")
}
I then get this error: Could not find com.ihealth.ihealthlibrary:iHealthLibrary:1.5.1.
Basically I can't figure out what's the correct package name and version to put in my config.
Where can I find this ?
This lib is really outdated. Go into the libraries build.gradle file and replace this implementation 'no.nordicsemi.android:dfu:1.6.1'
with: implementation 'no.nordicsemi.android:dfu:1.8.0'
then create a patch: yarn patch-package #ihealth/ihealthlibrary-react-native

itextpdf - itextg Android lint error

I'm trying to use itextg but I'm getting some gradle errors. Any idea? I tried version 5.5.9 and 5.5.10.
Execution failed for task ':app:lint'.
Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
The first 3 errors (out of 482) were:
/Users/xxxxx/.gradle/caches/modules-2/files-2.1/com.itextpdf/itextg/5.5.10/247811bfc4d8f4e99c909236eadf4dfc6dfa1615/itextg-5.5.10.jar: Error: Invalid package reference in library; not included in Android: javax.xml.crypto.dom. Referenced from com.itextpdf.text.pdf.security.MakeXmlSignature. [InvalidPackage]
/Users/xxxxx/.gradle/caches/modules-2/files-2.1/com.itextpdf/itextg/5.5.10/247811bfc4d8f4e99c909236eadf4dfc6dfa1615/itextg-5.5.10.jar: Error: Invalid package reference in library; not included in Android: javax.xml.crypto.dsig.dom. Referenced from com.itextpdf.text.pdf.security.MakeXmlSignature. [InvalidPackage]
/Users/xxxxx/.gradle/caches/modules-2/files-2.1/com.itextpdf/itextg/5.5.10/247811bfc4d8f4e99c909236eadf4dfc6dfa1615/itextg-5.5.10.jar: Error: Invalid package reference in library; not included in Android: javax.xml.crypto.dsig.keyinfo. Referenced from com.itextpdf.text.pdf.security.MakeXmlSignature. [InvalidPackage]
As far I understood, Android doesn't contain the following packages.
javax.xml.crypto.dom
javax.xml.crypto.dsig
That's why itextpdf lib can't find references to them. To fix it, add the following dependency.
implementation group: 'javax.xml.crypto', name: 'jsr105-api', version: '1.0.1'
Sounds like transitive libraries missing. Try using { transitives = true} on that dependency and see if it helps. Also it looks like they might be using straight Java modules for security underneath the hood, so you may have to make sure you specify the right JAVA_VERSION to use in your build.gradle as well.
Also confirm that you can expand the project view, to the itextg area and see the following JARs have been pulled in.
itextpdf-x.y.z.jar
itext-xtra-x.y.z.jar
itext-pdfa-x.y.z.jar
xmlworker-x.y.z.jar
If you don't see them, then you may need to download them and include them manually. I'm not familiar with itext enough to know how they include their transitive dependencies, but they do call it out on GitHub that they are used in this, so confirm they are there.

Error:(44, 13) Failed to resolve: org.achartengine:achartengine:1.2.0 [duplicate]

I have to create an application that makes extensive use of charts.
Reading the web I chose achartengine that seems to have everything I need.
I downloaded the jar file, I plugged in the libs folder, I selected "add to library" and I lunch the gradlew clean.
Result in the sources where I do the import of org.achartengine.xxxx I always returned the error that fails to resolve symbols .
Do you have suggestions?
Thank you
Andrea
I am able to use this library in my Android Studio project, this topic explains how to add AChartEngine repo to your project.
What I did:
Added following to project-wide build.gradle (one from the project root):
allprojects {
repositories {
...
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
}
For every module that uses the library, add this to its build.gradle (you may put this to the top-level build.gradle if it should be included in all modules):
dependencies {
...
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
Now I can use the library in the project, I see the classes in code assist popups and build runs as succeeds.
It seems like the new version (1.2.0) is not available for download anymore in the http://www.achartengine.org/ site. and that's why the gradle/maven method doesn't work (or the snapshot file was removed).
I succeeded using and adding it to my project by downloading the jar file from here:
https://github.com/ddanny/achartengine/files/460139/achartengine-1.2.0.zip

Does an Android .aar built with Gradle contain dependencies?

Not sure why I can't find any answers on this. If I convert my library project into an .aar using Gradle in Android Studio, does it retain all the dependencies of that module?
I'm asking because I'm trying to use a Gradle generated .aar locally, but it looks like only some of the original dependencies have been packaged. Namely, it complains that I'm missing 'OkHttp', but if I add it to the main project I get duplicate class errors.
Usually a library does not directly contain its dependencies. This does not matter whether it is an aar or a jar. Instead, the library declares its dependencies in the Gradle build file and they are resolved when someone uses the library.

Dependency error when using aar library

I have a module with a .aar file in libs folder. I used the solution posted here
[1]: http://kevinpelgrims.com/blog/2014/05/18/reference-a-local-aar-in-your-android-project/ to add the .aar file as dependency and was able to compile the module properly.
Now I want to use this module as a dependency to the main module in my project and compile. However when i try to compile, i do see an error which says that gradle was not able to find the particular .aar file. why would my main module not find a file which is in the libs folder of my sub module. Was wondering if anyone came across this issue.
my project structure is like this
--mainmodule
--build.gradle (submodule as a dependency)
--submodule
--libs
-- abc.aar
Here is the error gradle throws: When unzipping library ':abc:, either group, name or version is empty
If I understand your problem right and you've followed the steps described in the link you shared, then adding this to your mainmodule's build.gradle should do the job:
flatDir {
dirs "../submodule/libs"
}
You basically have the same issue that you fixed in your submodule, since the mainmodule is struggling to resolve transitive dependencies (abc.aar) of submodule.
Recommended way:
While the answer above should fix your issue, Android Studio supports a better way to do this. Import a local aar file via the File>New>New Module>Import .JAR/.AAR Package option in Android Studio v1.3+.
You can then have your submodule depend on that aar-module as follows:
dependencies {
compile project(':aar-module')
}

Categories

Resources