缺少JNI本地方法,但没有构建错误

问题描述 投票:0回答:1

在MyClass.java中,我有

package com.example.foo;
public class MyClass {
    public native void MyMethod();

而在MyClass.cpp中,我有

JNIEXPORT void JNICALL xJava_com_example_foo_MyClass_MyMethod(JNIEnv* env, jobject thiz)
{
    blah blah blah
}

在Java代码的其他地方,有一个叫做 MyMethod(); 然而,眼尖的人应该已经发现了,我不小心在我的本地方法名的开头打了一个 "x",这导致了一个未捕获的异常运行时错误。No implementation found for void com.example.foo.MyClass.MyMethod(). 有没有什么林蒂的魔法,我可以打开,检查我所有的。public native 方法有一个实现,如果没有就抛出一个build-timer错误? 谢谢。

android-studio java-native-interface android-build android-lint
1个回答
0
投票

Android Studio 3.6.3中,如果我重命名了 Java...boe 功能,以 xJava...boe.Android Studio catches it

© www.soinside.com 2019 - 2024. All rights reserved.