Open prabhav-mehra opened 1 year ago
I guess adding the following in your csproj solves the issue. But I dont know why? I know useInterpreter is set to true by default for Debug for Hot Reload but I can't understand how this is linked with my case.
<UseInterpreter>True</UseInterpreter>
<MtouchProfiling>True</MtouchProfiling>
Can you check to see if the libde265.so
and libheif.so
are making it into the aab file?
Also which device are you running this on , specifically which abi is it (x86, x86_64, armeabi-v7a or arm64-v8a).
Hi @s3743761. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@dellis1972 How do you check if the files are being included in .aab? also I am pretty sure it's not being included in Release
mode without
these enteries https://github.com/xamarin/xamarin-android/issues/8363#issuecomment-1733012862. As if it would have, it wouldn't say dll not found
.
I am testing it on arm64-v8a and both WSA
@s3743761
The aab file is just a zip file, you can rename the file to .zip and then extract all the contents. The libraries folders should be in the base
folder.
@dellis1972 Yes they are being included.
@s3743761 it might then be worth checking the dependencies of the .so files. One of the reasons a .so fails to load is if its compiled against library or other .so which cannot be found, you might be either missing a .so file or it was compiled against a library which is not present on the device... that said why it would work in debug but not release does kinda mean it is finding the dependencies. But it would be good to rule that out.
@grendello do you know the best way to check dependencies on android based .so files?
It would require the presence of NDK (or command line compiler tools on macOS) so that the llvm-readelf
binary is available:
$ llvm-readelf --needed-libs ./bin/Debug/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.android-x64/8.0.0-rc.2.23466.4/runtimes/android-x64/native/libmonosgen-2.0.so
NeededLibraries [
libc.so
libdl.so
liblog.so
libm.so
libz.so
]
llvm-readelf
can be found in the Android NDK, in the $NDK_ROOT/toolchains/llvm/prebuilt/$OS-$ARCH/bin/
directory
@s3743761 it might then be worth checking the dependencies of the .so files. One of the reasons a .so fails to load is if its compiled against library or other .so which cannot be found, you might be either missing a .so file or it was compiled against a library which is not present on the device... that said why it would work in debug but not release does kinda mean it is finding the dependencies. But it would be good to rule that out.
@grendello do you know the best way to check dependencies on android based .so files?
how does that change between a release and debug version? because the same app works in debug but not release
@prabhavmehra I tested your sample on my dotnet 7 install against an arm emulator and it works ok .
I see this
10-03 13:02:25.362 2007 2007 I DOTNET : heif-dec 1.0.0 LibHeifSharp v3.1.0 libheif v1.16.2
10-03 13:02:25.362 2007 2007 I DOTNET : HERE2____________________
10-03 13:02:25.362 2007 2007 I DOTNET : HEVC decoders:
10-03 13:02:25.362 2007 2007 I DOTNET : LiST______________________________________
10-03 13:02:25.362 2007 2007 I DOTNET : libde265 = libde265 HEVC decoder, version 1.0.12
10-03 13:02:25.362 2007 2007 I DOTNET : AV1 decoders:
10-03 13:02:25.362 2007 2007 I DOTNET : LiST______________________________________
10-03 13:02:25.362 2007 2007 I DOTNET :
10-03 13:02:25.363 2007 2007 I DOTNET : herenew
10-03 13:02:25.363 2007 2007 I DOTNET : nerw
10-03 13:02:25.363 2007 2007 I DOTNET : HERE00___________________________________________________________________________________
10-03 13:02:25.363 2007 2007 I DOTNET : HERE02___________________________________________________________________________________
10-03 13:02:25.363 2007 2007 I DOTNET : HERE01___________________________________________________________________________________8
10-03 13:02:25.363 2007 2007 I DOTNET : HERE12___________________________________________________________________________________
10-03 13:02:25.391 2007 2007 I DOTNET : new
10-03 13:02:25.392 2007 2007 I DOTNET : HERE13___________________________________________________________________________________
10-03 13:02:25.392 2007 2007 I DOTNET : HERE14___________________________________________________________________________________
10-03 13:02:25.392 2007 2007 I DOTNET : HERE15___________________________________________________________________________________
10-03 13:02:25.392 2007 2007 I DOTNET : newinside
10-03 13:02:25.449 2007 2007 I DOTNET : newinside2
@dellis1972 can you try it on an physical device if possible or WSA. I didn't try it to emulator
The sample worked on my Pixel 4
Fixed similar issue by adding
<AndroidBundleConfigurationFile>BundleConfig.json</AndroidBundleConfigurationFile>
into project PropertyGroup
and adding BundleConfig.json file with
{
"optimizations" : {
"uncompress_native_libraries" : {}
}
}
Fixed similar issue by adding
<AndroidBundleConfigurationFile>BundleConfig.json</AndroidBundleConfigurationFile>
into project PropertyGroup
and adding BundleConfig.json file with
{ "optimizations" : { "uncompress_native_libraries" : {} } }
Thanks bro, that fixed a similar issue in my project in which i did a "Jar binding" of a 3rd party library (an android manufacturer gave me .jar files with a SDK for their hardware). i was only running in debug.
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
VS 2022 17.7.4, Maui 7.0.92
Description
AndroidNativeLibrary/.so file is not getting picked in release mode but works in debug mode.
I am using a library which requires android native libraries to work. I have build the .so files and added to libs/{ABI} and these are getting picked in Debug mode and the functioality works. on Release mode I get
dll not found
for the same library.Steps to Reproduce
libheif-sharp
->src
->LibHeifSharp.sln
which has reference to all necessary projects.MauiApp1
on an Android device withDebug
mode.This works on
Debug
mode but will fail withlibheif dll not found
onRelease
mode.Link to public reproduction project repository
https://github.com/s3743761/Maui-repro/tree/main
Did you find any workaround?
No response
Relevant log output
No response