Hello Sir,
First of all, a big thanks to the Gurux team for providing such level of support and guidance.
As discussed on mail, I am having trouble to run the Gurux DLMS android mobile application.
I've cloned the GitHub repository - https://github.com/Gurux/Gurux.DLMS.Android,
then tried building and running it in android studio.
I was getting this error again & again :-
"""
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform appcompat-resources-1.7.0.aar (androidx.appcompat:appcompat-resources:1.7.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=28, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingNoClasspathTransform: /home/kshitiz/.gradle/caches/transforms-3/a760d1785787fb22a702d7d6da1c6b42/transformed/appcompat-resources-1.7.0-runtime.jar.
> Error while dexing.
"""
In short, the errors are :-
1. java.lang.NullPointerException
2. Error while dexing
3. Compilation failed to complete, origin: /home/kshitiz/.gradle/caches/transforms-3/a760d1785787fb22a702d7d6da1c6b42/transformed/appcompat-resources-1.7.0-runtime.jar:androidx/appcompat/graphics/drawable/DrawableContainerCompat$1.class
I've seen a youtube short on "Gurux Gurux" video titled "Gurux DLMS component for Android" - https://www.youtube.com/shorts/LIMeDqJ4x2o?feature=share
I need this android app apk.
Please suggest an approach for building this code, or please provide with an apk.
Kshitiz Saraf
PS: Is there any way to…
PS: Is there any way to attach screenshots here?
Hi, It seems that there are…
Hi,
It seems that there are changes in the new Android Studio that cause that this can't be build.
You can build the APK if you remove UI (App folder). Now you can use the apk, but there is no example user interface.
BR,
Mikko
Okay, so then, how will I be…
Okay, so then, how will I be able to use the app, without the UI?
Hello @Kurumi Sir, I have…
Hello @Kurumi Sir,
I have somehow managed to run the Gurux DLMS Component for Android on my Android 14 device, but I'm unable to find all the screens as we have in the Windows application.
I need to connect to the smart meter using these credentials :-
{Password/LLS, Transaction Key/HLS Key, Upgrade Key, Encryption Key, Authentication Key, System Title} and, I am not able to find all of these fields in the android app.
Please respond what can I do?
Basically, I am able to make a PC, but not MR or US, because for making a US, I need to input the encryption key, authentication key, and system title. And, there is no such screen available for inputting these values.
Hi, This is a simple example…
Hi,
This is a simple example. The purpose is to show how to establish the connection to the DLMS meter. Our customers usually make a specific UI. They don't want to read all values from the meter, but e.g. just read the load profile and send it to the server. Implement UI as you want to.
BR,
Mikko
Hi, I forget to say that you…
Hi,
I forget to say that you can also use apk from the maven if you add this line to build.gradle.
implementation 'org.gurux:gurux.dlms.android:2.0.5'
https://central.sonatype.com/artifact/org.gurux/gurux.dlms.android
BR,
Mikko
Okay, thanks! What…
Okay, thanks!
What difference will it create after adding this line in build.gradle?
Also, is there any pre-built apk which runs smoothly and have all the screens?
Hi, This is now fixed and it…
Hi,
This is now fixed and it works with Android Ladybug.
BR,
Mikko
Hello Kurumi Sir, Thanks for…
Hello Kurumi Sir,
Thanks for the reply, after changing some dependency versions in build.gradle file, the project successfully builds in android studio and the app Gurux DLMS runs on my android 14 device.
I have somehow managed to make MR and US association (authentication after selecting manufacturer - Indian Standard).
But, I am not able to connect/disconnect relay connection, there are no buttons like in the Windows application.
Can you please guide on how do I make relay connection buttons?
This property can be found named "DisconnectControl".
Hi Kshitiz Saraf, You can do…
Hi Kshitiz Saraf,
You can do it like this:
//Find disconnect control from the association view or create it.
GXDLMSDisconnectControl dc = new GXDLMSDisconnectControl();
byte[][] data = dc.remoteDisconnect(mClient);
GXReplyData reply = new GXReplyData();
readDataBlock(data, reply);
BR,
Mikko
Hello Kurumi Sir, Again, a…
Hello Kurumi Sir,
Again, a big thanks to your support.
The code you've provided for relay connections words fine. I can connect/disconnect on button click. This would have taken much longer time without your help.
Just a little issue I'm getting in finding the getter/setter of Frame Counter.
There is a field named "Frame Counter LN" in the Windows GXDLMSDirector application (in "Secured Connections" tab when adding a device).
In that Frame Counter LN, we enter a String value like "0.0.43.1.255" format, and it is a fixed value for a particular manufacturer meter (please correct me if I'm wrong).
I am not able to find this parameter in the code, instead, I am using the following line of code in MainFragment.java :-
mClient.getCiphering().setInvocationCounter(userInput); // Try starting with 0
In this scenario, I have to check the new invocation counter value and update it everytime I reconnect to the meter.
We need to make it more efficient for using the app.
Please suggest a way to implement it (or any other way, if this is not possible).
Thanks again.
Hi, Please, create a new…
Hi,
Please, create a new topic when you have a new question.
You can update the invocation counter like this:
https://github.com/Gurux/gurux.dlms.java/blob/c6cdf87ba570ecb5c73b16901…
BR,
Mikko
Okay sir, I'll create the…
Okay sir,
I'll create the new topic from next time.
Where should I use this function updateFrameCounter() ?
Can you provide an alternate for this, where user can enter "Invocation Counter Data Object Logical Name" (for e.g. "0.0.43.1.1.255") ?
Hi, You need to read the…
Hi,
You need to read the invocation counter before you establish the ciphered connection to the meter.
I'll add invocation counter to the worklist, but I can't say when it's released.
BR,
Mikko
Okay, sir.
Okay, sir.
Hi, Get the latest version…
Hi,
Get the latest version. updateFrameCounter is added to Android. You need just set the logical name of invocation counter.
mDevice.setInvocationCounter(LOGICAL_NAME);
BR,
Mikko
Hello Mikko Kurumi Sir,…
Hello Mikko Kurumi Sir,
Thanks for the updates.
I've tried the code you provided: mDevice.setInvocationCounter(LOGICAL_NAME);
It connects to the meter sometimes, and sometimes not, the value is updated in the updated android code, but sometimes it does not matches the actual one (I put logs for checking the value of invocation counter everytime).
Yet, I've made another way of doing it:-
I'm incrementing the counter by 100 after every "read" or "refresh" operation, as it connects if we give a greater value to the meter, and meters rejects the association if we provide a value of invocation counter lesser than the actual one.
This approach is running successfully in my case.
Please tell if I'm following a doable approach.
Hi, Don't add value by 100…
Hi,
Don't add value by 100. That does not solve the problem.
You must read the invocation counter before establishing the secured connection to the meter.
Some meters expect that there will be a small delay before the next connection.
BR,
Mikko
Okay, sir. I don't have a…
Okay, sir.
I don't have a problem reading the counter before connecting to the meter, but the code you updated does not work in every case.
It doesn't let smoothly connect to the meter everytime, in the end, I have to reset the counter by turning the electricity on-off.
I have read the updateFrameCounter() function, may be the issue lies in updating the counter when initializing connection.
The counter is updated only when we open the connection, sometimes, connection breaks in between reading the values, so the counter inside the meter is increased, but not in the application, what is the possible solution to this?
Hi, The reason for the…
Hi,
The reason for the connection breaks between reading might be inactivity timeout.
https://gurux.fi/Gurux.DLMS.Objects.GXDLMSIecHdlcSetup
If the connection breaks during the read, you need to establish the connection again and read the invocation counter value again.
BR,
Mikko
Hi, On establishing the…
Hi,
On establishing the connection again, the app throws GXGeneral error after 15 seconds.
Once, the app is closed and opened again, it is no longer able to connect to the meter because invocation counter in the meter has increased, but not saved in the app.
I've also tried saving in sharedpreferences : editor.putLong("invocation_counter", iv);
but, I'm not able to keep track of the value of invocation counter in any case.
Then what is the use of the function :- mDevice.setInvocationCounter(LOGICAL_NAME);
??
It only connects to the meter once, when the counter is already 0.
Thanks,
Kshitiz
Hi Kshitiz Saraf, Don't save…
Hi Kshitiz Saraf,
Don't save the invocation counter anywhere. It must read from the meter every time before the client establishes a secured connection to the meter.
You must set logical name of the invocation counter data object. Logical name can be anything, but it's something like this:
mDevice.setInvocationCounter("0.0.43.1.0.255");
BR,
Mikko
Okay, sir, I'll try, if you…
Okay, sir,
I'll try, if you can tell me where exactly should I use this function :-
mDevice.setInvocationCounter(LOGICAL_NAME);
For now, I'm using it immediately after the click event of "Open" button.
My code looks like this :-
Hi, You must to use the same…
Hi,
You must to use the same Logica name as you use in GXDLMSDirector. In your previous post, you said that you are using 0.0.43.1.1.255.
BR,
Mikko
Yes, sir, I am using the…
Yes, sir,
I am using the same logical name.
In the previous post, I gave an example logical name.
Hi, In your code you use a…
Hi,
In your code you use a different logical name. Check that.
mDevice.setInvocationCounter("0.0.43.1.3.255");
BR,
Mikko
Yes, sir, 0.0.43.1.3.255 -…
Yes, sir,
0.0.43.1.3.255 - This is the actual logical name of the invocation counter object.
0.0.43.1.1.255 was just an example I gave in my previous post.