GithubHelp home page GithubHelp logo

josephmoresena / nativeaot-androidhellojnilib Goto Github PK

View Code? Open in Web Editor NEW
57.0 57.0 6.0 59 KB

This repo is a sample of an Android JNI library compilated using NativeAOT

License: MIT License

C# 99.40% Shell 0.37% Batchfile 0.23%

nativeaot-androidhellojnilib's People

Contributors

josephmoresena avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nativeaot-androidhellojnilib's Issues

Publish with .Net 8 has some issues

Publish with .Net 8 has some issues:
Windows 10 64bit.

try1:
dotnet publish -r linux-bionic-arm64 -p:DisableUnsupportedError=true -p:PublishAotUsingRuntimePack=true -p:AssemblyName=libhello-jni -p:RemoveSections=true

error : Requested linker ('./android_fake_clang.cmd') not found in PA
TH. [C:\dev\net8tests\NativeAOT-AndroidHelloJniLib\AndroidHelloJniLib.csproj]

A change to .csproj row 49 - solves the error:
android_fake_clang.cmd

try2:
dotnet publish ...

error : Symbol stripping tool ('C/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objcopy') not found in PATH.

A change to .csproj row 55 + adding the path to system env param path - solves the error:
llvm-objcopy

try3:
dotnet publish ...

error MSB3073: The command "sed -i -z 's/global: _init; _fini;/global: /g;' obj\Release\net8.0\linux-bionic-arm64
native\libhello-jni.exports" exited with code 9009.

How to build with .NET 8?

Hello,

There seems to be some instructions missing, do you think you could update the README with instructions for .NET 8?

Thank you very much!

Why the JBoolean falseByte is 2 ?

public static JBoolean afunc(){
    return false;
}

Hi, Thank you for sharing the project.
Currently I have a problem. When I use JBoolean as the return value, it is always true. I found in jni's code that the returned value is 2. So, why is it set to 2 instead of 0? When I set falseByte to 0, the jni code works fine.

private static readonly Byte trueByte = 1;
private static readonly Byte falseByte = 0; // old is 2

Cast JObject to JByteArray

Hi,
I'm using your library to call a Java method with signature "([B)[B". That is, the return type is a byte array.

For this, I use CallObjectMethodADelegate and pass a pointer to my input array.

JObjectLocalRef result = callObjectMethod(jEnv, jObj, jMethodId, arrInput.GetUnsafeIntPtr());

I'm now stuck at processing the return type.
I want to transform the result somehow to a C# byte array. Other JNI libraries directly support jbytearray, which would allow casting the jobject to jbytearray and then go from there. However, this seems not possible here.

I'm looking forward to your answers!

Greetings,
Felix

bflat build has some issues

bflat build -r BFlatSupport/Rxmxnx.PInvoke.Extensions.dll --no-stacktrace-data --no-globalization --no-exception-messages -Os --no-pie --separate-symbols --os:linux --arch:arm64 --libc:bionic -o:libhello-jni.so

C:\dev\net8tests\NativeAOT-AndroidHelloJniLib\obj\Release\net8.0\linux-bionic-arm64.NETCoreApp,Version=v8.0.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute

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.