Git Product home page Git Product logo

anjay-java's Introduction

Anjay-java

Maven Central Maven Central

About

This project provides almost 1:1 API bindings between Anjay (written in C) and Java, thus making it possible to run Anjay clients on Android for example.

This is a preview release and we don't provide any guarantees about API stability or library reliability.

Using in Android Studio

This project is released to Maven Central repository as com.avsystem.anjay.anjay-android. Add mavenCentral() in repositories section of your build script and implementation 'com.avsystem.anjay:anjay-android:2.+' in dependencies to use it.

Using anjay-java package

Although the anjay-java package is released on Maven Central repository, it requires native shared library to be available. See the Compilation guide for details how to build the native library.

Compilation guide

First of all, remember to update all submodules using git submodule update --init --recursive.

Build library

./gradlew :library:build

The jar file is placed in library/build/libs directory. Note that it doesn't include the native library, which can be found in library/build/cmake directory.

Build and run demo

./gradlew :demo:build
java -Djava.library.path=library/build/cmake/ -jar demo/build/libs/demo.jar

By default, the client attempts to connect to coap://127.0.0.1:5683, but it can be customized using command line arguments. Use --help to see all available options.

Building for Android

ANDROID_SDK_ROOT=<path to Android SDK> ./gradlew -Pandroid :library:build

The aar files are in library/build/outputs/aar directory.

Running tests

./gradlew :testing:check

anjay-java's People

Contributors

panekk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anjay-java's Issues

InstanceCreate and InstanceRemove

Hello,

I have referred the demo code "DemoObject.java" and I am trying to understand how instanceCreate and instanceRemove callbacks work. I am currently not getting a callback to either of these functions when I am trying to create or delete an object on the server.

The demo code only says:
@OverRide
public void instanceCreate(int iid) {
throw new UnsupportedOperationException();
}

Can you please help me understand why this is happening? And in case we want to debug what is the function in Anjay C that calls instanceCreate(int iid)/instanceRemove(int iid) in Java, can you please point out that?

JNI callback

Hello,

From Anjay Java to Anjay C++ there is a JNI Iayer and I was working on writing a callback from native back to java. For this, I will need both "JNIEnv *" and "jobject" in arguments but I only see JNIEnv.

Can you please let me know how I can go ahead with writing this JNI callback? And is there a callback in the existing code for reference?

Build failure

Hi,
I am following the below steps in order to compile Anjay java in my Windows system.

git clone https://github.com/AVSystem/Anjay-java.git
Open Android Studio and import the project.
Open the terminal and run this command "./gradlew -Pandroid :library:build", I see the below errors.
Anjay_java1.txt
Followed the below steps on Linux:

git clone https://github.com/AVSystem/Anjay-java.git
git submodule update --init --recursive
Set the SDK and NDK path and run "./gradlew :library:build".
I am seeing the below error:
Anjay_java2.txt
Anjay_java3.txt
I have followed the below steps too:
cd native-library/deps/anjay
git checkout 2.15.0
cd ../../..
git add -u
git submodule update --init --recursive

Can you please help me with this issue? Also, can I get more steps so I can compile the code?
Is there a specific Java version that is needed for Anjay java to compile?
Can I compile Anjay java in Windows and Linux?

Build Error

I am using the below command to build, as specified in the Readme.
"./gradlew :library:build"

But I am facing the below error. Attached are the logs.
CMakePlugin.cmakeConfigure - ERRORS:
CMake Error in CMakeLists.txt:
Target "anjay" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES:
"MBEDTLS_INCLUDE_DIR-NOTFOUND"

Please let me know how to resolve this error and successfully build the jar file and the native shared library.
Log.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.