简体   繁体   English

从android应用程序调用c ++ DLL

[英]calling c++ DLL from android application

i create one dll in visual studio(i didn't use any win_API functions).i want to call this dlll from android i generated .apk file but while running this file i an facing this error. 我在Visual Studio中创建了一个dll(我没有使用任何win_API函数)。我想从android调用此dlll,我生成了.apk文件,但是在运行此文件时,我面临此错误。

"java.lang.UnsatisfiedLinkError: Couldn't load Testdll1 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/],nativeLibraryDirectories=[/data/app-lib/c, /system/lib]]]: findLibrary returned null " “ java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader [DexPathList [[zip file” / data / app /],nativeLibraryDirectories = [/ data / app-lib / c,/ system / lib]“中加载Testdll1 ]]:findLibrary返回null“

please advise me. 请建议我。

Ths s

DLLs run on Windows. DLL在Windows上运行。 They are not cross-platform. 它们不是跨平台的。 In order to run C++ on Android, you must use the Android NDK to compile your native code. 为了在Android上运行C ++,必须使用Android NDK编译本机代码。 You may find the details on this process here . 您可以在此处找到有关此过程的详细信息。

DLL is used on windows, not on Android. DLL是在Windows而不是Android上使用的。

You can download Android NDK for windows , read ndk example, then modify your code. 您可以下载适用于Windows的Android NDK ,阅读ndk示例,然后修改代码。

我认为* .so可以在Android上使用,因此您需要使用gcc或clang将库编译为* .so二进制文件,而不是使用msvc编译为dll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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