Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Android Proguard issue #2457

Closed
jitendrajadav opened this issue Apr 13, 2018 · 7 comments
Closed

Android Proguard issue #2457

jitendrajadav opened this issue Apr 13, 2018 · 7 comments
Labels
s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one.

Comments

@jitendrajadav
Copy link

Proguard is not working on release mode

Error :
Severity Code Description Project File Line Suppression State
Error Unable to access jarfile C:\Users...nuget\packages\name.atsushieno.proguard.facebook\5.3.2.2\build..lib\proguard.jar Demo.Android C:\Project\Demo.Android\PROGUARD

Description

Steps to Reproduce

Expected Behavior

Actual Behavior

Basic Information

Microsoft Visual Studio Professional 2017
Version 15.6.6
VisualStudio.15.Release/15.6.6+27428.2037
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Professional

Visual F# Tools 10.1 for F# 4.1 00369-60000-00001-AA420
Microsoft Visual F# Tools 10.1 for F# 4.1

Application Insights Tools for Visual Studio Package 8.11.10402.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.0.40314.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.51214.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 15.0.40215.0
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 15.0.40405.0
Azure Functions and Web Jobs Tools

C# Tools 2.7.0-beta3-62715-05. Commit Hash: db02128e6e3c4bdfc93e6ec425ac9162b4d4fe80
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service 2.0
JavaScript Language Service

JavaScript Project System 2.0
JavaScript Project System

JavaScript UWP Project System 2.0
JavaScript UWP Project System

Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.51212.2

Microsoft Continuous Delivery Tools for Visual Studio 0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 4.9.11-pre (71eb098)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 15.1.61801.210
Microsoft SQL Server Data Tools

SQLite & SQL Server Compact Toolbox 4.7
SQLite & SQL Server Compact Toolbox adds scripting, import, export, rename, query execution and much more to SQL Server Compact & SQLite Data Connections.

TypeScript Tools 15.6.20202.3
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.7.0-beta3-62715-05. Commit Hash: db02128e6e3c4bdfc93e6ec425ac9162b4d4fe80
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Universal Windows Apps 15.0.27428.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 4.9.0.753 (f0f46392f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.10.96 (a702a9ceb)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK 8.2.0.16 (HEAD/a78295902)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 11.9.1.24 (f62de47)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Screenshots

Reproduction Link

@pauldipietro pauldipietro added this to New in Triage Apr 13, 2018
@rmarinho rmarinho added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Apr 13, 2018
@rmarinho
Copy link
Member

We will need a repo project to look at your configuration.

@rmarinho rmarinho moved this from New to Needs Info in Triage Apr 13, 2018
@rmarinho rmarinho added the s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. label Apr 13, 2018
@yatespeter100
Copy link

I too am seeing a similar issue.
On Xamarin Forms 2.5.0.122203 with ProGuard enabled no issue
On Xamarin Forms 2.5.1.444934 with ProGuard NOT enabled - no issue
On Xamarin Forms 2.5.1.444934 with ProGuard enabled - I get the attached exception on app load

capture

@PureWeen
Copy link
Contributor

PureWeen commented Apr 13, 2018

@yatespeter100 @jitendrajadav do you have a repro by chance? I have a couple projects that I use proguard with in release mode and they are working fine for me on version 2.5.1 of Xam Forms.

@jitendrajadav in your case that looks like something going on with a particular 3rd party library you are using

@yatespeter100 I'm guessing there's probably something either getting linked out or processed by pro guard that your app needs. If you enable diagnostic build output you can see in there where Java will give a bunch of ProGuard warnings. The other thing you can do is check logcat. Usually those NullReferenceExceptions will say some class is missing and then you can just add it to your proguard file

Here's the proguard.cfg file I'm using

-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-keep class com.microsoft.windowsazure.messaging.** { *; }
-dontwarn com.microsoft.windowsazure.messaging.**
-keep class com.google.firebase.** { *; }
-dontwarn com.google.firebase.**
-keep class android.support.v7.widget.** { *; }
-dontwarn android.support.v7.widget.*
-keep class android.support.v4.widget.Space { *; }
-dontwarn android.support.v4.widget.Space
-keep class net.hockeyapp.android.** { *; }
-dontwarn net.hockeyapp.android.*

@yatespeter100
Copy link

@PureWeen Thanks I will try and take a look over the weekend and let you know what I find.

@yatespeter100
Copy link

@PureWeen So I have looked at the other tickets created. I am able to find my proguard_xamarin file in the obj folder of the Android project. I have tried adding some lines to the cfg file there but they get overridden in build. Am I doing something wrong? I don't see a proguard file at the root of my Android project. I only have it enabled for release and not debuug. Any tips much appreciated

@PureWeen
Copy link
Contributor

this talks about adding the proguard file

https://docs.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/proguard?tabs=vswin

it's pretty easy the only caveat is if you're on windows to be sure to read this part
https://docs.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/proguard?tabs=vswin#troubleshooting

@yatespeter100
Copy link

yatespeter100 commented Apr 18, 2018

@PureWeen Ok looks like your suggestions worked. The only lines I had to add to the custom cfg file were -keep class android.support.v7.widget.** { *; }
-dontwarn android.support.v7.widget.*

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one.
Projects
None yet
Development

No branches or pull requests

4 participants