APK 源码预置到ROM时,编译成功,运行失败
    JNI_OnLoad returned bad version (-1)

    问题:源码编译时自动混淆了
    解决方法:
    mk中配置混淆脚本。

    1. # 代码混淆
    2. LOCAL_PROGUARD_FLAG_FILES := proguard-rules.pro

    混淆配置 proguard-rules.pro

    1. # Add project specific ProGuard rules here.
    2. # You can control the set of applied configuration files using the
    3. # proguardFiles setting in build.gradle.
    4. #
    5. # For more details, see
    6. # http://developer.android.com/guide/developing/tools/proguard.html
    7. # If your project uses WebView with JS, uncomment the following
    8. # and specify the fully qualified class name to the JavaScript interface
    9. # class:
    10. #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
    11. # public *;
    12. #}
    13. # Uncomment this to preserve the line number information for
    14. # debugging stack traces.
    15. -keepattributes SourceFile,LineNumberTable
    16. # If you keep the line number information, uncomment this to
    17. # hide the original source file name.
    18. -renamesourcefileattribute SourceFile
    19. -ignorewarnings
    20. -keepattributes Signature,*Annotation*
    21. # 混淆后就会生成 类名->混淆后类名 的映射关系
    22. -verbose
    23. -printmapping mapping.txt
    24. # 不做预检验,preverify是proguard的四个步骤之一
    25. # Android不需要preverify,去掉这一步可以加快混淆速度
    26. -dontpreverify
    27. # 保留所有的本地native方法不被混淆
    28. -keepclasseswithmembernames class * {
    29. native <methods>;
    30. }
    31. ### common-log
    32. -dontwarn ishawn.common.log.**
    33. -keep class ishawn.common.log.** { *;}
    34. -dontwarn me.pqpo.librarylog4a.**
    35. -keep class me.pqpo.librarylog4a.** { *;}