Hi,
I’m trying to create a custom plugin to interact with a hardware NFC reader, connected via UART.
The manufacturer provides a SDK to interact with the device.
In the documentation, they say you must add to your gradle file this:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies{
implementation 'com.gitee.lochy:dkcloudid-uart-android-sdk:v2.2.4'
}
So, I’ve created my plugin with a plugin.gradle with that content
And inside plugin.xml
<platform name="android">
<framework src="plugin.gradle" custom="true" type="gradleReference" />
...
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.INTERNET" />
</config-file>
</platform>
When I try to compile, I get errors like this
> Task :app:compileDebugJavaWithJavac FAILED
/platforms/android/app/src/main/java/es/sernutec/plugins/UARTPlugin.java:8: error: package com.gitee.lochy does not exist
import com.gitee.lochy.UartNfcDevice;
In the log I can’t see any information about connecting to jitpack to download the dependencies
Could anybody help me?
Thanks
I believe you are supposed to specify maven dependencies using the framework
tag: Plugin.xml API - Apache Cordova
Hi,
thanks for your reply
I tried,
<framework src="com.gitee.lochy:dkcloudid-uart-android-sdk:v2.2.4" />
but I fails:
Could not find com.gitee.lochy:dkcloudid-uart-android-sdk:v2.2.4.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/gitee/lochy/dkcloudid-uart-android-sdk/v2.2.4/dkcloudid-uart-android-sdk-v2.2.4.pom
https://repo.maven.apache.org/maven2/com/gitee/lochy/dkcloudid-uart-android-sdk/v2.2.4/dkcloudid-uart-android-sdk-v2.2.4.pom
Is not published in repo.maven.apache
I finally could compile by manually downloading dependencies with gradle, and using this tag
<source-file src="src/android/libs/dkcloudid-uart-android-sdk-v2.2.4.jar" target-dir="libs" />
But not sure is that solution resolve all dependencies fine, as I’m getting errors like:
UARTPlugin: java.lang.UnsatisfiedLinkError: dlopen failed: library “libdk_serial_port.so” not found
Keep on digging
I went back to first approach (plugin.gradle file), and slightly modified it:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.gitee.lochy:dkcloudid-uart-android-sdk:v2.2.4'
}
Now it compiles and serial port gets open.