Bug 35255 - Proguard with api 23 won't compile on Release with google play services (27.0.0.0)
Summary: Proguard with api 23 won't compile on Release with google play services (27.0...
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2015-10-26 10:30 UTC by Zahi Kramer
Modified: 2017-10-23 07:47 UTC (History)
17 users (show)

Tags: BZCU
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Zahi Kramer 2015-10-26 10:30:09 UTC
When adding google play services to vanilla android project which target api 23 (android 6.0),
on Release Build , when Enabling Proguard , Build failed with error code:
"error MSB6006: "java.exe" exited with code 1"

and there are a lot of proguard warnings like: 
"PROGUARD : warning : com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.entity.BasicHttpEntity...."

simple to reproduce:
1. Add new android blank project
2. Turn to Release Build.
3. Compile (should be ok)
4. Now add some Google Play Services (like Ads)  Nuget.
5. Build. (should get error above)

I saw that there is a known problem on android java dev itself here:

https://code.google.com/p/android-developer-preview/issues/detail?id=3001

But couldn't solved it here in Xamarin.
Comment 1 Prashant Cholachagudda 2015-10-28 01:07:51 UTC
@zahi,
Could share the diagnostic build output from your project?
You can find the instructions here - https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/
Comment 2 Zahi Kramer 2015-10-28 11:11:18 UTC
ok.
Sent you.
Comment 3 Zahi Kramer 2015-10-28 11:11:49 UTC
Notice it's also on XS
Comment 4 Ben Foote 2015-11-11 07:47:22 UTC
I've got the same issue with API 23, and it still occurs when I uninstall API 23, and instead target API 22.

I've tried all the tricks I could find on the Xamarin Forums, and Stack Overflow. (Such as increasing the Java Heap Size, cleaning/rebuilding, and even uninstalling/reinstalling Xamarin.)

As soon as I turn off Proguard, the build process works fine. However, this is a big deal, because my company can't distribute an APK file that hasn't been run through Proguard first.

I hope Xamarin is able to find/fix this issue.
Comment 5 Peter Collins 2015-11-18 14:51:03 UTC
It appears to me that this is an upstream issue with google play services that will be fixed in an upcoming release.

In the interim, it appears that these are effectively only 'warnings' coming from proguard, and a possible workaround is to add a custom proguard configuration file to your project with the following:
> -keep class com.google.android.gms.** { *; }
> -dontwarn com.google.android.gms.**

For more information on this process, please see https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release/#ProGuard
Comment 6 Pat Gulotta 2016-02-20 22:33:00 UTC
Peter Collin's fix did not work for me.  I currently can not create a release build if proguard is enabled.  Hoping this gets fixed soon.  Any ETA Xamarin?
Comment 7 Atsushi Eno 2016-02-22 05:32:52 UTC
This is not an Android issue but a GooglePlayServices components issue.

@Redth: was there GooglePlayServices components for API Level 23? The component that Zahi references shouldn't of course work because it references org.apache.http API which is removed in API Level 23.
Comment 8 Pat Gulotta 2016-03-13 00:16:58 UTC
Xamarin wrote the bindings for the the GPS NuGet pkg, so I am still waiting for this fix from Xamarin?  When will be fixed?  I really need an ETA.
Comment 9 Jon Dick 2016-03-14 12:54:29 UTC
Please try v29.0.0.1 of Google Play Services available on NuGet.
Comment 10 Ben Foote 2016-03-14 14:10:56 UTC
My project doesn't use Google Play Services at all, and I just after your post Jon Dick, updated my Android SDK and Xamarin to the latest stable version, and still get this error.

"java.exe" exited with code 1.

Still a problem.
Comment 11 Pat Gulotta 2016-03-14 14:52:00 UTC
I am using the Nuget pkg v29.0.0.1, the latest release version from Xamarin, when the error msg occurs.
Comment 12 Jon Dick 2016-03-14 15:07:38 UTC
Can you attach a solution that can reproduce the issue? Thanks.
Comment 13 Ali 2016-04-28 07:30:47 UTC
I have the same problem too.
Comment 14 Henrique Duarte 2016-05-15 13:55:50 UTC
I am using the Nuget pkg v29.0.0.1, and I'm having the same problem too.
Comment 15 Jon Dick 2017-09-28 15:17:57 UTC
Newer versions of these bindings play nicely with proguard.
Comment 16 Sergei 2017-10-23 07:47:26 UTC
The problem still exists. I'm getting com.google.firebase.messaging.zzc: can't find referenced class com.google.android.gms.measurement.AppMeasurement	and other similar messages when enabling proguard. So i can't archive release version of project with proguard. I have latest versions of google play libraries.