Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error MSB6006: "java.exe" exited with code 1 when ProGuard enabled

I try to resolve this issue last few days, still without success. If I build release version without proguard then everything is OK.

I read many topics about possible problems but nothing help in my case. So far I did as follow:

  1. Java max heap size - 1G
  2. Use "mklink" - mklink /j C:\android-sdk “C:\Program Files (x86)\Android\android-sdk”
  3. Created own proguard.cfg with content:

General Android -dontwarn org.apache.http.** -dontwarn android.net.http.AndroidHttpClient

Android Support Library

-keep class android.support.multidex.MultiDexApplication

-keep class android.support.v4.**

-keep class android.support.v7.** { public *; }

Google Play Billing

-keep class com.android.vending.billing.**

Google Play Services

-dontwarn com.google.android.gms.internal.*

-keep class * extends java.util.ListResourceBundle { protected java.lang.Object[][] getContents(); }

  1. Manually update ProGuard to latest version.

And the result is 0 warnings and 1 error.

ERROR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1929,3): error MSB6006: "java.exe" exited with code 1.

What else can I do? Please help.

Update. I created brand new app "Xamarin Hello World" and there "ProGuard" works. So it must be something wrong with my app not a system. But visual studio doesn't show me any other error apart that Java code 1. So how to track where is a problem?

UPDATE The problem was in my "proguard.cfg" file. I copy content from other source and one line there should be comment but it wasn't. So this problem gone. But now some warnings come out:

2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF](Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) 
2>Copying resources from program jar [G:\ApkiC-Sharp\GNote\GNote\GNote.Android\obj\Release\__library_projects__\Xamarin.GooglePlayServices.Basement\library_project_imports\classes.jar](TaskId:345) 
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) 
2>Copying resources from program jar [G:\ApkiC-Sharp\GNote\GNote\GNote.Android\obj\Release\__library_projects__\Xamarin.GooglePlayServices.Maps\library_project_imports\classes.jar] (TaskId:345) 
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) 
2>Copying resources from program jar [G:\ApkiC-Sharp\GNote\GNote\GNote.Android\obj\Release\__library_projects__\Xamarin.GooglePlayServices.Tasks\library_project_imports\classes.jar] (TaskId:345) 
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])

What dose it mean? Is it something to worried about? How to check if "ProGuard" works fine?

like image 571
Klick Avatar asked Oct 01 '17 08:10

Klick


1 Answers

I was also facing the same issue on my Windows 10 x64 and visual studio 2015. I have set the JDK path to JDK 1.8 under android settings in Visual studio tools ->options ->xamarin ->java development kit location. it was pointing to "C:\Program Files (x86)\Java\jdk1.7.0_55" and I made it to "C:\Program Files\Java\jdk1.8.0_31", and issue has been fixed.

like image 142
Biswajit Pal Avatar answered Dec 09 '22 08:12

Biswajit Pal