如何使用Xamarin Android的.Net Reactor混淆dll APK [英] How to use .Net Reactor obfuscated dll of Xamarin Android APK

查看:273
本文介绍了如何使用Xamarin Android的.Net Reactor混淆dll APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Xamarin Android的新手.我已使用Visual Studio 2015社区版创建了一个应用程序.我已将解决方案配置"设置为发布".

I am new to Xamarin Android. I have created an App using Visual Studio 2015 Community Edition. I have set the Solution Configuration to Release.

对于混淆,我使用了.Net Reactor.

For obfuscation I used .Net Reactor.

这就是我试图混淆的方式

This is how I tried to obfuscate

1:构建应用后,我将转到Bin \ Release文件夹

1: Once I build the App, I will go to Bin\Release folder

2:混淆App.dll

2: Obfuscate the App.dll

3:用Bin \ Release,Obj \ Release和Obj \ Release \ Assemblies中的混淆dll替换原始dll

3: Replace the original dll with obfuscated dll in Bin\Release, Obj\Release and Obj\Release\assemblies

4:转到工具"->"Android"->发布"

4: Go to Tools->Android->Publish

但是,当我尝试发布混淆的dll时,它将替换为原始dll.

However when I tried to publish the obfuscated dll will be replaced by original dll.

那我做错了什么?我是否必须手动打包apk文件.如果是这种情况,我该怎么办?

So what I am doing wrong ? Do I have to manually pack the apk file. If that is the case how can I do that?

推荐答案

1)发布未混淆的应用程序.apk,将其重命名为.zip.

1) Publish not obfuscated an application .apk, rename it to .zip.

2)将文件 Mono.Android.dll 从文件夹"程序集"移动到文件夹 YourProjectName \ bin \ Release

2) Move from it the file Mono.Android.dll from the folder "assemblies" into the folder YourProjectName\bin\Release.

3)创建一个新的.NET Reactor项目,设置正确的设置(取消选中 Anti ILDASM ,而且混淆过程会重命名用于反射或序列化的字段.为避免应用崩溃,应该将排除项设置为忽略某些类型或方法.) 将此项目文件保存到 YourXamarinFolder \ YourProjectName \ bin \ Release .

3) Create a new .NET Reactor project, set the right settings (uncheck Anti ILDASM, also the obfuscation process renames a fields that is used in reflection or serialization. To avoid crash of app, should set the exclusions for ignore some types or methods.). Save this project file into YourXamarinFolder\YourProjectName\bin\Release.

4)创建文件 obfuscate_android.bat ,在此处插入代码:

4) Create the file obfuscate_android.bat, insert here the code:

 "C:\Program Files (x86)\Eziriz\.NET Reactor\dotNET_Reactor.exe" -project "NET_Reactor_Project_Name.nrproj"
  copy "YourProjectName_Secure\YourProjectName.dll" "YourProjectName.dll"
  DEL "YourProjectName_Secure\*.dll" "YourProjectName_Secure\*.pdb" /q

将此文件移动到 YourProjectName \ bin \ Release 中.

5)卸载Xamarin项目并编辑YourProjectName.csproj 找到下一个区块:

5) Unload your Xamarin project and edit YourProjectName.csproj Find the next block:

<PropertyGroup Condition = " '$ (Configuration) | $ (Platform)' == 'Release | AnyCPU'">
<! -- Insert here the link to obfuscate_android.bat -->
<PostBuildEvent>obfuscate_android.bat </ PostBuildEvent>
 </ PropertyGroup>

6)保存所有并重新加载项目

6) Save all and Reload project

7)运行发布.

这篇关于如何使用Xamarin Android的.Net Reactor混淆dll APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆