我想用Unity库(jar + native lib)混淆我的android应用程序。我正在创建Proguard配置:
-dontusemixedcaseclassnames
-dontwarn android.support.**
-verbose
-dontoptimize
-dontpreverify
-libraryjars /libs/unity-classes.jar
-keep class com.unity3d.** { *; }
-keep class org.fmod.** { *; }
-keepclassmembers class com.tms.rarus.videoserver.* { *; }
-keepclassmembers class com.unity3d.player.** { *; }
-keepclassmembers class org.fmod.** { *; }
-keepclasseswithmembernames class * {
native <methods>;
}
当我尝试用proguard obfusctae启动应用程序时,我会得到下一个错误日志:
02-06 11:44:56.538: D/dalvikvm(13604): Trying to load lib /data/app-lib/com.unity.game-1/libmain.so 0x41b78330
02-06 11:44:56.538: D/dalvikvm(13604): Added shared lib /data/app-lib/com.unity.game-1/libmain.so 0x41b78330
02-06 11:44:56.554: E/Unity(13604): Unable to locate player settings. caused by: org.e.a.b: resource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory make sure that parser implementing XmlPull API is available
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeVideoFrameCallback:VILII
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSoftInputClosed:V
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetTouchDeltaY:VF
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetInputString:VL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetInputCanceled:VZ
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetExtras:VL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetDefaultDisplay:VI
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeResume:V
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeResize:VIIII
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeRequestedAA:I
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeRequested32bitDisplayBuffer:Z
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeRender:Z
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeRecreateGfxState:VL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativePause:Z
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeInjectEvent:ZL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeInitWWW:VL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeFocusChanged:VZ
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeFile:VL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeDone:V
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeActivityIndicatorStyle:I
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.initJni:VL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.UnitySendMessage:VLLL
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetLocationStatus:VI
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeSetLocation:VFFFFDF
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeForwardEventsToDalvik:VZ
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/UnityPlayer;.nativeDeviceOrientation:VI
02-06 11:44:57.022: D/dalvikvm(13604): Unregistering JNI method Lorg/fmod/FMODAudioDevice;.fmodUnblockStreaming:I
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lorg/fmod/FMODAudioDevice;.fmodProcess:IL
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lorg/fmod/FMODAudioDevice;.fmodInitJni:I
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lorg/fmod/FMODAudioDevice;.fmodGetInfo:II
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lorg/fmod/FMODAudioDevice;.fmodBlockStreaming:I
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lorg/fmod/FMODAudioDevice;.fmodProcessMicData:ILI
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/ReflectionHelper;.nativeProxyInvoke:LILL
02-06 11:44:57.030: D/dalvikvm(13604): Unregistering JNI method Lcom/unity3d/player/ReflectionHelper;.nativeProxyFinalize:VI
没有proguard所有的工作都是成功的。