YetAnotherHttpHandler
YetAnotherHttpHandler copied to clipboard
If a dll is not included or configured correctly for the architecture, please indicate dll name in error trace
Currently the error is indicated as
DllNotFoundException:
Cysharp.Net.Http.YetAnotherHttpHandler.Native assembly:<unknown assembly> type <unknown type> member:(null)
DebugException="System.DllNotFoundException:
Cysharp.Net.Http.YetAnotherHttpHandler.Native assembly:<unknown assembly> type <unknown type> member:(null)"
Please amend to indicate the name of the missing dll.
Platform: Android.
Hi, I have just encountered similar issue while trying to run my example code on Android.
I can see that armv7 is not confirmed as working, it's may be the root cause.
Logcat output
2023/09/15 17:12:20.039 2207 2241 Error Unity DllNotFoundException: Cysharp.Net.Http.YetAnotherHttpHandler.Native assembly:<unknown assembly> type:<unknown type> member:(null)
2023/09/15 17:12:20.039 2207 2241 Error Unity at (wrapper managed-to-native) Cysharp.Net.Http.NativeMethods.yaha_init_runtime(Cysharp.Net.Http.NativeMethods/yaha_init_runtime_on_status_code_and_headers_receive_delegate,Cysharp.Net.Http.NativeMethods/yaha_init_runtime_on_receive_delegate,Cysharp.Net.Http.NativeMethods/yaha_init_runtime_on_complete_delegate)
2023/09/15 17:12:20.039 2207 2241 Error Unity at Cysharp.Net.Http.NativeLibraryWrapper..ctor (Cysharp.Net.Http.NativeClientSettings settings) [0x00028] in .\Library\PackageCache\com.cysharp.yetanotherhttphandler@bd2c526021\NativeLibraryWrapper.cs:38
2023/09/15 17:12:20.039 2207 2241 Error Unity at Cysharp.Net.Http.NativeHttpHandlerCore..ctor (Cysharp.Net.Http.NativeClientSettings settings) [0x00008] in .\Library\PackageCache\com.cysharp.yetanotherhttphandler@bd2c526021\YetAnotherHttpHandler.cs:215
2023/09/15 17:12:20.039 2207 2241 Error Unity at Cysharp.Net.Http.YetAnotherHttpHandler.SetupHandler () [0x0000d] in .\Library\PackageCache\com.cysharp.yetanotherhttphandler@bd2c526021\YetAnotherHttpHandle
Hello @RubenGarcia, Have you found how to solve DllNotFoundException on Android platform ? Thx
Not yet. I should solve https://github.com/Cysharp/YetAnotherHttpHandler/issues/22 beforehand.
Ok, I got it to work.
First, clone https://github.com/Cysharp/YetAnotherHttpHandler Install rust and
rustup target add aarch64-linux-android
rustup target install armv7-linux-androideabi
cargo install cargo-ndk
cargo ndk -t arm64-v8a build
cargo ndk build
Then copy the cs files from YetAnotherHttpHandler\src\YetAnotherHttpHandler and YetAnotherHttpHandler\src\YetAnotherHttpHandler\Shims into a folder in your assets. Then create a directory yaha in Assets/Plugins, and two directories armv7 and arm64 inside. copy native/target/*/debug/*.so inside these directories, each in their target architecture. Select each of them and ensure platform is android, cpu is the correct one for each of them, and load on startup is selected. Edit NativeMethodsFuncPtr.g.cs and NativeMethods.g.cs and change the
#else
const string __DllName = "...";
#endif
to
#else
const string __DllName = "libyaha_native.so";
#endif
Then enable allowUnsafeCode in Player Settings. Then click on "Build and run".
Well done !
I am stuck at cargo ndk -t arm64-v8a build
step.
But it seems that general Android support is on the way (commits about android build : https://github.com/Cysharp/YetAnotherHttpHandler/commit/3944918f26895f4d672cda55d32ecec9bd7c71fa => armv7 https://github.com/Cysharp/YetAnotherHttpHandler/commit/fc3c2ade50242473532de0494961d8816e2fab3d => android-x64
I guess I will wait for v0.2 release
You need to run the cargo ndk lines from YetAnotherHttpHandler/native directory. Also, add --release to the cargo ndk lines to get optimized libraries.
Yes, I have seen first command cd native
in other topic , but I obtain :
-
a warning "warning: some crates are on edition 2021 which defaults to
resolver = "2"
, but virtual workspaces default toresolver = "1"
" -
an error "error: failed to run custom build command for
ring v0.16.20
" due to a "file not found" in command "C:\Program" "Files\Unity\Hub\Editor\2022.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang"
I cannot figure out which file is spoken about : I can see YetAnotherHttpHandler\native\target\aarch64-linux-android\debug\build\ring-ffea147bf53e7271\out\aesv8-armx-linux64.o and .cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\pregenerated\aesv8-armx-linux64.S that are referenced.
I have the warning about the resolver, it is harmless. For your error, it looks like it is getting confused by the space in "Program Files". Maybe check that and move the ndk to somewhere else without spaces. If you still have issues, I can upload the so file I generated.
I have the warning about the resolver, it is harmless. For your error, it looks like it is getting confused by the space in "Program Files". Maybe check that and move the ndk to somewhere else without spaces. If you still have issues, I can upload the so file I generated.
Can you upload the SO file, i think it would solve all my problems
armv7-linux-androideabi, release libyaha_native.zip
aarch64-linux-android, release libyaha_native.zip
I used the files you've uploaded and they worked fine in both device types. However, this is the case for .apk files. When we tried using these in production (when we built an .aab file) the Arm7 app couldn't find and load the dll. Do you have any idea why this is happening or do you have a possible fix? By the way I uncompressed the .aab file and found the .so file in arm7 -> lib folder.
No, I did not create aab files, so I can't help there.