简体   繁体   中英

Is it possible to generate a dll with android ndk for testing purposes?

I am developing an app which uses a native library. I would like to test it using a non-android dependent framework like Robolectric.

The problem is, that the native functionality cannot be loaded using

System.loadLibrary("mylib");

because on Windows it looks for "mylib.dll", and I am only able to build libmylib.so which is not compatible with windows.

Is there a way to build a dll (it would be only used for testing purposes ofc)?

If you want to test your application on windows, then you need a *.dll. *.so files are unix "shared libraries" - same functionality as windows' dll. You have to build your C++ sources with an IDE like Visual Studio, Code Blocks, or anything else that can build sources for windows.

In fact, when building with "ndk-build" for android, you are cross-compiling for an Unix system with an ARM architecture mostly. When running on windows, you'll probably be on x86 / x86_64.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM