Android Studio 3.1.2 - 无法运行C++子例程"No implementation found for Java.lang.String..."
Android Studio 3.1.2 - Can't run a C++ subroutine "No implementation found for Java.lang.String..."
我的代码可以编译,但是当我调用C++子例程时,应用程序会因不满意的LinkError而死亡。
在CMakeLists中.txt:
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/crlTCheckkey.cpp)
在选项卡 1.java 中:
package com.labyrinthsys.crltext;
String statusString;
String keyPath;
statusString = crlTCheckkey(keyPath);
...
public native String crlTCheckkey(String keyPath);
In crlTCheckkey.cpp:
#include <jni.h>
#include <string>
using namespace std;
extern "C" JNIEXPORT jstring
JNICALL
Java_com_labyrinthsys_crltext_Tab1_crlTCheckkey(
JNIEnv *env,
jobject, /* this */
jstring keyFilePath) {
我得到的错误是:
java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String com.labyrinthsys.crltext.Tab1.crlTCheckkey(java.lang.String) (tried Java_com_labyrinthsys_crltext_Tab1_crlTCheckkey and Java_com_labyrinthsys_crltext_Tab1_crlTCheckkey__Ljava_lang_String_2)
at com.labyrinthsys.crltext.Tab1.crlTCheckkey(Native Method)
at com.labyrinthsys.crltext.Tab1.onClick(Tab1.java:118)
我在当地打听过,但没有运气。我错过了什么?谢谢!
这很烦人,但我从构建中完全删除了有问题的 cpp 文件,然后从头开始再次引入它,不知何故它现在可以工作了。
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- c++20[[no.unique_address]]中的新功能是什么
- 以线程安全的方式调用"QQuickPaintedItem::updateImage(const QImage&image)"(no QThread)
- "no matching function for call to 'Vector::Vector'"错误
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- Softmax Implementation in C++
- 处理"no operator found"
- 我在 ifstream input_file(文件名)行中收到错误"no matching function to call";
- 如何解决"no Qt platform plugin could be initialized"问题?
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- 为什么当我在 std::string 中打开文件名的 fstream 时出现"no matching function"错误?
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- do while 循环中的 if 语句以 yes 或 no 结尾
- 从 TVector2 类派生复杂类:"No matching function for call to Complex::Complex()"
- 错误消息:使用"string* +="后"no match for 'operator+='"
- Eulers 项目问题 no 345 听不懂几行代码
- "No-Const Pointer to Const "调用功能
- 如何在 c++ 中将 s1 和 s2 与 no if 语句进行比较
- Android Studio 3.1.2 - 无法运行C++子例程"No implementation found for Java.lang.String..."