APK 源码预置到ROM时,编译成功,运行失败
JNI_OnLoad returned bad version (-1)
问题:源码编译时自动混淆了
解决方法:
mk中配置混淆脚本。
# 代码混淆LOCAL_PROGUARD_FLAG_FILES := proguard-rules.pro
混淆配置 proguard-rules.pro
# Add project specific ProGuard rules here.# You can control the set of applied configuration files using the# proguardFiles setting in build.gradle.## For more details, see# http://developer.android.com/guide/developing/tools/proguard.html# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:#-keepclassmembers class fqcn.of.javascript.interface.for.webview {# public *;#}# Uncomment this to preserve the line number information for# debugging stack traces.-keepattributes SourceFile,LineNumberTable# If you keep the line number information, uncomment this to# hide the original source file name.-renamesourcefileattribute SourceFile-ignorewarnings-keepattributes Signature,*Annotation*# 混淆后就会生成 类名->混淆后类名 的映射关系-verbose-printmapping mapping.txt# 不做预检验,preverify是proguard的四个步骤之一# Android不需要preverify,去掉这一步可以加快混淆速度-dontpreverify# 保留所有的本地native方法不被混淆-keepclasseswithmembernames class * {native <methods>;}### common-log-dontwarn ishawn.common.log.**-keep class ishawn.common.log.** { *;}-dontwarn me.pqpo.librarylog4a.**-keep class me.pqpo.librarylog4a.** { *;}
