简体   繁体   English

未找到 Android NDK 发布 Build 方法

[英]Android NDK release Build method not found

I have a little problem with an native Android Libary.我对原生 Android Libary 有一点问题。 I am calling a Method from native Code like this:我正在从本机代码调用方法,如下所示:

        clazz = env->FindClass("<package>/NativeInterface");;
        midlog = env->GetStaticMethodID(clazz, "callStr", "(Ljava/lang/String;)V");
        jstring jstr = env->NewStringUTF(s.c_str());
        env->CallStaticVoidMethod(clazz, midlog, jstr);

When I Build my App in Debug mode, I have no problems with this.当我在调试模式下构建我的应用程序时,我没有任何问题。 But when i Build in release mode, I get an error :但是当我在发布模式下构建时,出现错误:

Throwing new exception 'no static method "L<package>/NativeInterface;.callStr(Ljava/lang/String;)V

Could it be that Android Studio is obforscating the java code and my native libary is not able to find the methode any longer?是不是 Android Studio 正在屏蔽 Java 代码,而我的本机库无法再找到该方法? What is my Problem here?我的问题是什么?

Obfuscation per se is not a problem, but ProGuard can remove "unused" methods.混淆本身不是问题,但 ProGuard 可以删除“未使用”的方法。 You can use -keep option or plant a fictional call to prevent striping of callStr()您可以使用-keep选项或callStr()一个虚构的调用来防止对callStr()条带化

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

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