Java.exe exited with code 1. Xamarin - android

Trying to make archive for publishing and has this error
Java heap size is set to 1G.PROGUARD : warning : com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.client.HttpClient
PROGUARD : warning : com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.client.HttpClient
PROGUARD : warning : com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntityEnclosingRequest
PROGUARD : warning : com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntityEnclosingRequest
PROGUARD : warning : there were 148 unresolved references to classes or interfaces.
PROGUARD : warning : there were 2 unresolved references to program class members.
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1833,3): error MSB6006: "java.exe" exited with code 1.
I made archive for publishing at Friday and everything was ok. Yesterday I have updates and installed them, but this didn't solve the problem
What's wrong?

Problem is solved
create file named proguard.cfg inside Android project in the solution. Right click and set Build Action to ProguardConfig.
I add this to proguard file
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
Make sure you save file as UTF-8 and NOT UTF-8 BOM

Related

missing EOF at '-keepclass' proguard android

when I add one line in proguard file its showing error Error:com.android.build.gradle.shrinker.parser.ProguardParserException: ProGuard configuration parser error: /root/projectDirectory/myprojectname/app/proguard-rules.pro line 42:0 missing EOF at '-keepclass'.
If I remove this file it shows Error :
Method code too large.
The project builds successful without proguard.
Any suggestion ??
Thanks.
This is because you're using an invalid rule with something like:
-keepclass com.example.activity {*;}
it should be
-keep class com.example.activity {*;}

Proguard build failed(Eclipse)

This question already have been asked many times, but I am not able to resolve it. I am trying to export my app using eclipse for final release, but I am getting the below error.
I already added
-keep class com.afollestad.materialdialogs.*{ *; }
-dontwarn com.afollestad.materialdialogs.**
-dontshrink
Error resolved, but after running my app crashed.
please help me
this is the error:
Proguard returned with error code 1. See console
Warning: com.afollestad.materialdialogs.util.DialogUtils: can't find referenced method 'android.content.res.ColorStateList getColorStateList(int)' in class android.content.Context
Warning: com.afollestad.materialdialogs.util.DialogUtils: can't find referenced method 'int getColor(int)' in class android.content.Context
You should check if you need to specify additional program jars.
Warning: there were 2 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)

ant release proguard fails, but under eclipse works

I have a pretty big project with an elaborate proguard.cfg .
This project builds OK under eclipse, proguard runs without errors, and the app works perfectly, it's been my normal workflow for months.
I am trying to build it from command line using ant.
I have updated build.xml, etc.. on the projects and its library project using
android update project -p .
android update project -s --target android-17 -p .
The debug version, ant debug, gets built successfully
However, ant release fails proguard, complaining about missing classes.
From what I could decipher (a lot of non-faltal warnings pop up) the problems are related to a missing inner class in one of my (thousand) classes, and to missing R (resources) of a dependent library project. This is strange, both things do exist, the library projects gets built OK from eclipse & ant, and that inner class i don't know, the parent class is pretty trivial.
Why does it build under eclipse and not using command line? Shouldn't the updated build scripts produce the same result?
Proguard: Errors Related to LIbrary Project Resources
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
Proguard: Related to inner class not found
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$2: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$3: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
That's strange, I found the problem by trial and error.
The inner class not found was an innocent private anonymous runnable like:
private Runnable mBlinkRunner=new Runnable() {
public void run() {
.
. couple simple lines
.
}
};
I changed it to ...
protected Runnable mBlinkRunner=new Runnable() {
public void run() {
.
. couple simple lines
.
}
};
and it worked... I wonder why this happens, there should be like hundreds of runnables like these through the project.

Can't enable Proguard on Android project containing jsch lib

I am trying to use Proguard to obfuscate my Android app which makes use of the library jsch-1.50.jar for uploading files to an SFTP server.
When I do an export from Eclipse, I get warnings "can't reference class" and nothing is produced. I have tried all manner of options to tell Proguard to ignore the jsch classes, but it's not making any difference and therefore I wonder if I am misunderstanding how this works. I am not too worried about the optimisation, but I would like the code obfuscated.
I have setup the proguard-properties as follows:
-keep class com.jcraft.jsch.jce.*
-keep class * extends com.jcraft.jsch.KeyExchange
-keep class com.jcraft.jsch.**
-keep class com.jcraft.jzlib.ZStream
-keep class com.jcraft.jsch.Compression
-keep class org.ietf.jgss.*
-libraryjars /libs/jsch-0.1.50.jar
The project-properties file contains an entry for "proguard.config=proguard-project.txt".
The output from the export with duplicates removed:-
Warning: com.jcraft.jsch.jcraft.Compression: can't find referenced class com.jcraft.jzlib.ZStream
Warning: com.jcraft.jsch.jgss.GSSContextKrb5: can't find referenced class org.ietf.jgss.Oid
Warning: com.jcraft.jsch.jgss.GSSContextKrb5: can't find referenced class org.ietf.jgss.GSSManager
Warning: com.jcraft.jsch.jgss.GSSContextKrb5: can't find referenced class org.ietf.jgss.GSSException
Warning: com.jcraft.jsch.jgss.GSSContextKrb5: can't find referenced class org.ietf.jgss.GSSContext
Warning: com.jcraft.jsch.jgss.GSSContextKrb5: can't find referenced class org.ietf.jgss.MessageProp
Warning: there were 44 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.
Would very much appreciate any pointers.
Thanks
Mike
After a bit more investigation, I found the following...
I had forgotten to include jzlib-1.1.1.jar in the project with the corresponding
-libraryjars /libs/jzlib-1.1.1.jar
entry in the proguard-properties.txt.
Also to ignore the warning regards references to "class org.ietf.jgss", I tried the suggested method of excluding the referencing class
-libraryjars /libs/jsch-0.1.50.jar(!com.jcraft.jsch.jgss/GSSContextKrb5.class)
but that didn't help. In the end, I went with :-
-dontwarn org.ietf.jgss.**

Ant + Proguard provide android-support-v4.jar errors

While building project using ANT 1.8.2 and proguarg 4.8.1
[proguard] Unexpected error while evaluating instruction:
[proguard] Class = [android/support/v4/view/AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl]
[proguard] Method = [newAccessiblityDelegateBridge(Landroid/support/v4/view/AccessibilityDelegateCompat;)Ljava/lang/Object;]
[proguard] Instruction = [18] areturn
[proguard] Exception = [java.lang.IllegalArgumentException] (Can't find any super classes of [android/support/v4/view/AccessibilityDelegateCompatIcs$1] (not even immediate super class [android/view/View$AccessibilityDelegate]))
[proguard] Unexpected error while performing partial evaluation:
[proguard] Class = [android/support/v4/view/AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl]
[proguard] Method = [newAccessiblityDelegateBridge(Landroid/support/v4/view/AccessibilityDelegateCompat;)Ljava/lang/Object;]
[proguard] Exception = [java.lang.IllegalArgumentException] (Can't find any super classes of [android/support/v4/view/AccessibilityDelegateCompatIcs$1] (not even immediate super class [android/view/View$AccessibilityDelegate]))
BUILD FAILED
E:\adt-bundle-windows\sdk\tools\ant\build.xml:864: java.lang.IllegalArgumentException: Can't find any super classes of [android/support/v4/view/AccessibilityDelegateCompatIcs$1] (not even immediate super class [android/view/View$AccessibilityDelegate])
android-support-v4.jar is in class path and project dependecies...
From Eclipse all but debug version is built OK.
Ant display those errors...
How do avoid this? I understand if Eclipse builds this OK, the Ant have to build too..
P.S. My project is android-10 target and I don't want and can't make it target-16 if somebody'll advise...
what about try to add these to your proguard.cf?
-libraryjars libs/android-support-v4.jar
-dontwarn android.support.v4.**
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep public class * extends android.support.v4.**
-keep public class * extends android.app.Fragment
You should specify a target SDK in your project.properties that in this case contains 'android.view.View$AccessibilityDelegate' (SDK level 14 or higher). ProGuard's shrinking/optimization/obfuscation need at least the same base SDK that was used for compiling the application and its libraries. The support library was compiled against this more recent SDK, so ProGuard needs it as well.
You can still specify a different target/min/max SDK in your AndroidManifest.xml, for running the application. You should of course make sure that the application is indeed compatible with those specified SDKs.

Categories

Resources