josephmoresena / nativeaot-androidhellojnilib Goto Github PK
View Code? Open in Web Editor NEWThis repo is a sample of an Android JNI library compilated using NativeAOT
License: MIT License
This repo is a sample of an Android JNI library compilated using NativeAOT
License: MIT License
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.
Hi, not sure where to put this, but I created a simplified version of this guide for regular console apps (to produce ELF executables rather than libraries)
Someone may find this useful:
https://gist.github.com/Bip901/af46447d7e7b0b9647f0841946979e0e
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!
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
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 -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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.