Reputation: 801
I have issue with my Xamarin Forms project with ProGuard, i have the following error: java.exe" exited with code 1
and multiple warning such as: okio.Okio: can't find referenced class java.nio.file.Path
I have tried many solution such as:
None of these solutions are working, i've tried multiple clean and build as well. However one thing is strange, i can build my project when my Linking is set to "None" instead of "SDK Assemblies Only". When ProGuard is enabled and my Linking is set to SDK Assemblies Only it is not working, is it normal?
This is an example of my output build:
Note: there were 7 references to unknown classes. (TaskId:223) 1> You should check your configuration for typos. (TaskId:223) 1> (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass) (TaskId:223) 1> Note: there were 2 classes trying to access generic signatures using reflection. (TaskId:223) 1> You should consider keeping the signature attributes (TaskId:223) 1> (using '-keepattributes Signature'). (TaskId:223) 1> (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) (TaskId:223) 1> Note: there were 17 unkept descriptor classes in kept class members. (TaskId:223) 1> You should consider explicitly keeping the mentioned classes (TaskId:223) 1> (using '-keep'). (TaskId:223) 1> (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass) (TaskId:223) 1> Note: there were 10 unresolved dynamic references to classes or interfaces. (TaskId:223) 1> You should check if you need to specify additional program jars. (TaskId:223) 1> (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass) (TaskId:223) 1> Note: there were 4 accesses to class members by means of introspection. (TaskId:223) 1> You should consider explicitly keeping the mentioned class members (TaskId:223) 1> (using '-keep' or '-keepclassmembers'). (TaskId:223) 1> (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember) (TaskId:223) 1>PROGUARD : warning : there were 14 unresolved references to classes or interfaces. 1> You may need to add missing library jars or update their versions. (TaskId:223) 1> If your code works fine without the missing classes, you can suppress (TaskId:223) 1> the warnings with '-dontwarn' options. (TaskId:223) 1> (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) (TaskId:223) 1> java.io.IOException: Please correct the above warnings first. (TaskId:223)
These are my warnings:
Severity Code Description Project File Line Suppression State Warning there were 14 unresolved references to classes or interfaces. Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning CS0169 The field 'MainActivity.ContextCompat' is never used Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\MainActivity.cs 24 Active Warning CS0067 The event 'Vwm_Listing.PopulateList' is never used Test.App.Forms C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Forms\ViewModels\Vwm_Listing.cs 7 Active Warning okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Path Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Path Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Path Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Path Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.OpenOption Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.OpenOption Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.OpenOption Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.OpenOption Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Files Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Files Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.Okio: can't find referenced class java.nio.file.Files Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Test.App.Droid C:\User\Projects\Test\Test.Mob.App\Test.App\Test.App.Droid\PROGUARD
Warning Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. Test.App.Droid C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets 1820
What should i do? I have no idea how to solve this..
Upvotes: 1
Views: 688
Reputation: 589
I used Square.Picasso library on my Xamarin.Android project with no problem and using Linking set to SDK and User Assemblies.
My ProGuard configuration file contains this:
-dontwarn org.codehaus.**
-dontwarn java.nio.file.**
-dontwarn com.square.**
-dontwarn okio.**
-keep public class android.support.v7.widget.FitWindowsLinearLayout
-keep public class android.support.design.widget.AppBarLayout
You said that you have the newest ProGuard version in your Android SDK, so it should work!
Upvotes: 0
Reputation: 730
Try upgrading JDK
https://bugzilla.xamarin.com/show_bug.cgi?id=44187
Xamarin Stable 15.2 is not that stable as it should :)
Upvotes: 0
Reputation: 91
post your warning error.Also add some lines in your progaurd.pro file.
-keep class org.apache.http.** { *; }
-dontnote org.apache.http.**
-dontwarn org.apache.http.**
-dontwarn android.net.*
Upvotes: 1