简体   繁体   English

ProGuard:Android PortSip混淆

[英]ProGuard : Android PortSip obfuscation

After obfuscated the code, I have the truncated error log: 混淆代码后,我将截断错误日志:

08-05 14:54:34.587  15299-15299/sn.ok E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: sn.ok, PID: 15299
    java.lang.NoSuchMethodError: no static or non-static method "Lcom/portsip/PortSipSdk;.unInitializeSDK()V"
            at java.lang.Runtime.nativeLoad(Native Method)

How to obfuscate the following code : 如何混淆以下代码:

static {
        System.loadLibrary("portsipcore");
}

Edit: After adding the last code, I get this error 编辑:添加最后一个代码后,出现此错误

08-17 19:11:36.517  16967-16967/sn.ok E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: sn.ok, PID: 16967
    java.lang.NoSuchMethodError: no method with name='receiveSIPEvent' signature='(I)V' in class sn/ok/PortSipSdk;
            at sn.ok.PortSipSdk.initializeSDK(Native Method)
            at sn.ok.MyApplicationFubu$1.onPostExecute(SourceFile:331)
            at android.os.AsyncTask.finish(AsyncTask.java:632)
            at android.os.AsyncTask.access$600(AsyncTask.java:177)
            at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:157)
            at android.app.ActivityThread.main(ActivityThread.java:5356)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
            at dalvik.system.NativeStart.main(Native Method)

The native code is invoking the Java code. 本机代码正在调用Java代码。 ProGuard doesn't (can't) know this, so you have to explicitly preserve the called classes, fields, and methods from being removed or renamed: ProGuard不知道,因此您必须明确保留被调用的类,字段和方法,以免被删除或重命名:

-keep class com.portsip.PortSipSdk {
    void unInitializeSDK();
}

See the ProGuard manual > Examples > Processing callback methods 请参阅ProGuard手册>示例> 处理回调方法

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

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