如何在启用proguard的情况下修复Xamarin.Android构建错误?

时间:2016-01-25 10:43:07

标签: c# android xamarin

您好我试图通过启用proguard来减少我的应用程序大小。 我使用Visual Studio 2015,以及它的Xamarin.Android应用程序。

我一直收到错误:

Java.exe exited with code 1. File: Xamarin.Android.Common.targets.

网上所有帖子都参考Gradle,但不确定gradle的含义,我认为它是某种插件,但我没有使用它......

关于修复的任何想法?它以前在同一个项目中工作,所以很不寻常。

>Using "Proguard" task from assembly "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
1>Task "Proguard" (TaskId:220)
1>  Task Parameter:ProguardJarPath=C:\SDKS\tools\proguard\lib\proguard.jar (TaskId:220)
1>  Task Parameter:JavaToolPath=C:\PROGRA~1\Java\JDK18~1.0_6\\bin (TaskId:220)
1>  Task Parameter:JavaPlatformJarPath=C:\SDKS\platforms\android-19\android.jar (TaskId:220)
1>  Task Parameter:MonoPlatformJarPath=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.4\mono.android.jar (TaskId:220)
1>  Task Parameter:ClassesOutputDirectory=obj\Release\android\bin\classes (TaskId:220)
1>  Task Parameter:ProguardCommonXamarinConfiguration=obj\Release\proguard\proguard_xamarin.cfg (TaskId:220)
1>  Task Parameter:ProguardGeneratedReferenceConfiguration=obj\Release\proguard\proguard_project_references.cfg (TaskId:220)
1>  Task Parameter:ProguardGeneratedApplicationConfiguration=obj\Release\proguard\proguard_project_primary.cfg (TaskId:220)
1>  Task Parameter:ProguardConfigurationFiles=
1>          {sdk.dir}tools\proguard\proguard-android.txt;
1>          {intermediate.common.xamarin};
1>          {intermediate.references};
1>          {intermediate.application};
1>          ;
1>       (TaskId:220)
1>  Task Parameter:
1>      LibraryProjectJars=
1>          obj\Release\__library_projects__\Square.OkHttp\library_project_imports\okhttp-2.5.0.jar
1>          obj\Release\__library_projects__\Square.OkIO\library_project_imports\okio-1.6.0.jar (TaskId:220)
1>  Task Parameter:
1>      AdditionalJavaLibraryReferences=
1>          C:\Users\srj\AppData\Local\Xamarin\Android.Support.v4\23.1.1.0\embedded\classes.jar
1>          C:\Users\srj\AppData\Local\Xamarin\Android.Support.v4\23.1.1.0\embedded\libs\internal_impl-23.1.1.jar (TaskId:220)
1>  Task Parameter:ProguardJarInput=obj\Release\proguard\__proguard_input__.jar (TaskId:220)
1>  Task Parameter:ProguardJarOutput=obj\Release\proguard\__proguard_output__.jar (TaskId:220)
1>  Task Parameter:DumpOutput=obj\Release\proguard\dump.txt (TaskId:220)
1>  Task Parameter:PrintSeedsOutput=obj\Release\proguard\seeds.txt (TaskId:220)
1>  Task Parameter:PrintUsageOutput=obj\Release\proguard\usage.txt (TaskId:220)
1>  Task Parameter:PrintMappingOutput=obj\Release\proguard\mapping.txt (TaskId:220)
1>  Proguard (TaskId:220)
1>    JavaPlatformJarPath: C:\SDKS\platforms\android-19\android.jar (TaskId:220)
1>    MonoPlatformJarPath: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.4\mono.android.jar (TaskId:220)
1>    ClassesOutputDirectory: obj\Release\android\bin\classes (TaskId:220)
1>    ProguardGeneratedApplicationConfiguration: obj\Release\proguard\proguard_project_primary.cfg (TaskId:220)
1>    ProguardJarInput: obj\Release\proguard\__proguard_input__.jar (TaskId:220)
1>    ProguardJarOutput: obj\Release\proguard\__proguard_output__.jar (TaskId:220)
1>    ProguardConfigurationFiles: (TaskId:220)
1>      
1>          {sdk.dir}tools\proguard\proguard-android.txt;
1>          {intermediate.common.xamarin};
1>          {intermediate.references};
1>          {intermediate.application};
1>          ;
1>       (TaskId:220)
1>    JavaSourceFiles: (TaskId:220)
1>    JavaLibraries: (TaskId:220)
1>    ExternalJavaLibraries: (TaskId:220)
1>    DoNotPackageJavaLibraries: (TaskId:220)
1>    LibraryProjectJars: (TaskId:220)
1>      obj\Release\__library_projects__\Square.OkHttp\library_project_imports\okhttp-2.5.0.jar (TaskId:220)
1>      obj\Release\__library_projects__\Square.OkIO\library_project_imports\okio-1.6.0.jar (TaskId:220)
1>    UseProguard: False (TaskId:220)
1>    EnableLogging: False (TaskId:220)
1>    DumpOutput: obj\Release\proguard\dump.txt (TaskId:220)
1>    PrintSeedsOutput: obj\Release\proguard\seeds.txt (TaskId:220)
1>    PrintMappingOutput: obj\Release\proguard\mapping.txt (TaskId:220)
1>  Environment Variables passed to tool: (TaskId:220)
1>    java_tool_options= -Dfile.encoding=UTF8 (TaskId:220)
1>    proguard_home=C:\SDKS\tools\proguard (TaskId:220)
1>  C:\PROGRA~1\Java\JDK18~1.0_6\\bin\java.exe -jar C:\SDKS\tools\proguard\lib\proguard.jar -include C:\SDKS\tools\proguard\proguard-android.txt -include obj\Release\proguard\proguard_xamarin.cfg -include obj\Release\proguard\proguard_project_references.cfg -include obj\Release\proguard\proguard_project_primary.cfg "-injars 'obj\Release\proguard\__proguard_input__.jar';'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.4\mono.android.jar';'obj\Release\__library_projects__\Square.OkHttp\library_project_imports\okhttp-2.5.0.jar';'obj\Release\__library_projects__\Square.OkIO\library_project_imports\okio-1.6.0.jar';'C:\Users\srj\AppData\Local\Xamarin\Android.Support.v4\23.1.1.0\embedded\classes.jar';'C:\Users\srj\AppData\Local\Xamarin\Android.Support.v4\23.1.1.0\embedded\libs\internal_impl-23.1.1.jar'" "-libraryjars 'C:\SDKS\platforms\android-19\android.jar'" -outjars "obj\Release\proguard\__proguard_output__.jar"  (TaskId:220)
1>  ProGuard, version 4.7 (TaskId:220)
1>  Reading input... (TaskId:220)
1>  Reading program jar [C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\obj\Release\proguard\__proguard_input__.jar] (TaskId:220)
1>  Reading program jar [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.4\mono.android.jar] (TaskId:220)
1>  Reading program jar [C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\obj\Release\__library_projects__\Square.OkHttp\library_project_imports\okhttp-2.5.0.jar] (TaskId:220)
1>  Reading program jar [C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\obj\Release\__library_projects__\Square.OkIO\library_project_imports\okio-1.6.0.jar] (TaskId:220)
1>  Reading program jar [C:\Users\srj\AppData\Local\Xamarin\Android.Support.v4\23.1.1.0\embedded\classes.jar] (TaskId:220)
1>  Reading program jar [C:\Users\srj\AppData\Local\Xamarin\Android.Support.v4\23.1.1.0\embedded\libs\internal_impl-23.1.1.jar] (TaskId:220)
1>  Reading library jar [C:\SDKS\platforms\android-19\android.jar] (TaskId:220)
1>  Initializing... (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.app.ActivityCompat$OnRequestPermissionsResultCallback' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.app.FragmentManager$BackStackEntry' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.app.FragmentManager$OnBackStackChangedListener' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'mono.android.support.v4.app.FragmentManager_OnBackStackChangedListenerImplementor' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.app.LoaderManager$LoaderCallbacks' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.app.SharedElementCallback' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.content.Loader$OnLoadCanceledListener' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.content.Loader$OnLoadCompleteListener' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.media.session.MediaControllerCompat$Callback' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.media.session.MediaSessionCompat$Callback' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.media.session.MediaSessionCompat$OnActiveChangeListener' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'mono.android.support.v4.media.session.MediaSessionCompat_OnActiveChangeListenerImplementor' (TaskId:220)
1>  Note: the configuration doesn't specify which class members to keep for class 'android.support.v4.media.VolumeProviderCompat' (TaskId:220)
1>PROGUARD : warning : okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Files
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Files
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Files
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Path
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.OpenOption
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Path
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.OpenOption
1>PROGUARD : warning : okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Path
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.OpenOption
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.Path
1>PROGUARD : warning : okio.Okio: can't find referenced class java.nio.file.OpenOption
1>PROGUARD : warning : okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
1>  Note: android.support.v4.text.ICUCompatApi23: can't find dynamically referenced class libcore.icu.ICU (TaskId:220)
1>  Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU (TaskId:220)
1>  Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class com.android.org.conscrypt.OpenSSLSocketImpl (TaskId:220)
1>  Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl (TaskId:220)
1>  Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class android.net.Network (TaskId:220)
1>  Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'icon' dynamically (TaskId:220)
1>        Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { int icon; }' (TaskId:220)
1>        Maybe this is program field 'colorpoint.xamarin.xandroid.R$drawable { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.R$attr { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.R$id { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.app.LauncherActivity$ListItem { android.graphics.drawable.Drawable icon; }' (TaskId:220)
1>        Maybe this is library field 'android.app.Notification { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.app.Notification$Action { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.appwidget.AppWidgetProviderInfo { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.content.pm.PackageItemInfo { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.content.pm.ResolveInfo { int icon; }' (TaskId:220)
1>        Maybe this is library field 'android.inputmethodservice.Keyboard$Key { android.graphics.drawable.Drawable icon; }' (TaskId:220)
1>        Maybe this is library field 'android.speech.tts.TextToSpeech$EngineInfo { int icon; }' (TaskId:220)
1>  Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'title' dynamically (TaskId:220)
1>        Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { java.lang.CharSequence title; }' (TaskId:220)
1>        Maybe this is library field 'android.R$attr { int title; }' (TaskId:220)
1>        Maybe this is library field 'android.R$id { int title; }' (TaskId:220)
1>        Maybe this is library field 'android.app.Notification$Action { java.lang.CharSequence title; }' (TaskId:220)
1>        Maybe this is library field 'android.preference.PreferenceActivity$Header { java.lang.CharSequence title; }' (TaskId:220)
1>  Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'actionIntent' dynamically (TaskId:220)
1>        Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { android.app.PendingIntent actionIntent; }' (TaskId:220)
1>        Maybe this is library field 'android.app.Notification$Action { android.app.PendingIntent actionIntent; }' (TaskId:220)
1>  Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService' (TaskId:220)
1>  Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService' (TaskId:220)
1>  Note: the configuration keeps the entry point 'android.support.v4.media.session.MediaSessionCompat { MediaSessionCompat(android.content.Context,android.support.v4.media.session.MediaSessionCompat$MediaSessionImpl); }', but not the descriptor class 'android.support.v4.media.session.MediaSessionCompat$MediaSessionImpl' (TaskId:220)
1>  Note: the configuration keeps the entry point 'android.support.v4.media.session.MediaSessionCompat$QueueItem { MediaSessionCompat$QueueItem(android.os.Parcel,android.support.v4.media.session.MediaSessionCompat$1); }', but not the descriptor class 'android.support.v4.media.session.MediaSessionCompat$1' (TaskId:220)
1>  Note: there were 2 references to unknown classes. (TaskId:220)
1>        You should check your configuration for typos. (TaskId:220)
1>  Note: there were 2 unkept descriptor classes in kept class members. (TaskId:220)
1>        You should consider explicitly keeping the mentioned classes (TaskId:220)
1>        (using '-keep'). (TaskId:220)
1>  Note: there were 5 unresolved dynamic references to classes or interfaces. (TaskId:220)
1>        You should check if you need to specify additional program jars. (TaskId:220)
1>  Note: there were 3 accesses to class members by means of introspection. (TaskId:220)
1>        You should consider explicitly keeping the mentioned class members (TaskId:220)
1>        (using '-keep' or '-keepclassmembers'). (TaskId:220)
1>PROGUARD : warning : there were 14 unresolved references to classes or interfaces.
1>           You may need to specify additional library jars (using '-libraryjars'). (TaskId:220)
1>  java.io.IOException: Please correct the above warnings first. (TaskId:220)
1>      at proguard.Initializer.execute(Initializer.java:321) (TaskId:220)
1>      at proguard.ProGuard.initialize(ProGuard.java:211) (TaskId:220)
1>      at proguard.ProGuard.execute(ProGuard.java:86) (TaskId:220)
1>      at proguard.ProGuard.main(ProGuard.java:492) (TaskId:220)
1>  Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF8 (TaskId:220)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1845,3): error MSB6006: "java.exe" exited with code 1.
1>Done executing task "Proguard" -- FAILED. (TaskId:220)
1>Done building target "_CompileToDalvik" in project "ColorPoint.Xamarin.XAndroid.csproj" -- FAILED.: (TargetId:139)
1>

0 个答案:

没有答案