Unable to create .apk file after introducing Crypto Obfuscator into Xamarin.Android project

I have a task to confuse my Xamarin Android project (let's call it AndrProj) along with its libraries: two PCLs (let's call them PCL1 and PCL2) and Android library (AndrLib). PCL2 and AndrLib also have links to PCL1.

I was inspired by this article and decided to try Crypto Obfuscator Demo .Net v2015 for my purposes.

I used my "Visual Studio Project Integration Wizard". PCL1 was set as "First Project" and AndrProj as "Last Project". To start with, only the default settings were used. Now when I build my project everything is perfect. Dlls in the \ bin \ Release folder are confusing.

I would be totally happy if I could create an .apk file and try it out on an Android device. But when I select Build -> Archive for Publishing in Xamarin Studio, after a while I see "Build FAILED" and

Obfuscation error: - "AndrLib" assembly already obfuscated Crypto Obfuscator. If you have run the Visual Studio Project Integration Wizard in Visual Studio projects, you cannot get confused from the Crypto Obfuscator UI unless you disable the automatic obfuscation for that project from the Crypto Obfuscator Project menu → Enable / Disable Visual Studio Integration 'and rebuild your solution in Visual Studio to produce unordered assemblies.

I also tried "Export Android Package (.apk)" from Visual Studio 2013, but it gives less information and doesn't generate the .apk.

I believe it only complains about AndrLib because it comes first in alphabetical order among PCL1, PCL2 and AndrLib. And the more global problem is that creating the .apk makes all assemblies tangled up again. Is there a way to skip this second confusion? Or ignore this problem?

+3


source to share


1 answer


Well the solutions were pretty straightforward: I had to use MSBuild.exe directly with the target SignAndroidPackage instead of creating an .apk from the IDE.


Here is a post from tech support regarding the issue described (might be helpful to someone):

If your solution fails to build after running MSBuild Integration, try the following:

Modify the multi-page version of the build log as follows: Menu Visual Studio Tools → Options → Projects and Solutions → Build and Run> Extend MSBuild Project Output, set this to Details.



Now look at the Visual Studio Output window for any hints or additional information about the cause of the error.

Change the number of threads used by MSBuild to 1 as follows: Visual Studio Tools Menu -> Options -> Project and Solutions -> Build and Run -> Max Concurrent Threads: Set this to 1.

If you get an error like "Build" XYZ "is already obfuscated with Crypto Obfuscator ..." when you run (CTRL + F5) or Debug (F5) your solution, then try to do Clean (Visual Studio Menu Build → Clear menu item) and then run (CTRL + F5) or Debug (F5).

Build failure can also occur if you run the wizard multiple times, each time selecting a different "first" project. This issue usually occurs through a "file not found" error in the build / exit log. To solve this problem, start with clean non-integrated .csproj / .vbproj files (the wizard copies the original non-integrated project files to the extension .backup_% timestamp% before changing the project files, one by one you can open .csproj / .vbproj in a text editor and delete the XML, added by the wizard, which can be found at the end of the file). Then start the wizard again with the correct first and last projects.

0


source







All Articles