Proguard isn't working with Chartboost? - android

I'm getting proguard error when trying to compile project with Chartboost Android SDK:
[proguard] Unexpected error while editing code:
[proguard] Class = [com/chartboost/sdk/Libraries/d]
[proguard] Method = [b(Landroid/content/Context;)Lcom/chartboost/sdk/Libraries/CBOrientation;]
[proguard] Exception = [java.lang.IllegalArgumentException] (Invalid instruction offset [65674] in code with length [236])
I added those lines to proguard.cfg but this didn't help:
-libraryjars ./libs/chartboost.jar
-keep class com.chartboost.sdk.** { *; }
I tried to compile project both on Mac & PC, but result is the same. Does anyone can help me with this issue?

Error has gone after update to beta version of their SDK.

Related

Android build fails with kotlin-reflect and proguard

I am unable to build my release product if I include kotlin-reflect with it. I attempted adding this to proguard configuration:
-keep class kotlin.reflect.** { *; }
But it did not help at all. Here is the error result from the gradle build:
Optimizing...
Unexpected error while performing partial evaluation:
Class = [kotlin/reflect/jvm/internal/impl/renderer/DescriptorRendererImpl]
Method = [renderPossiblyInnerType(Ljava/lang/StringBuilder;Lkotlin/reflect/jvm/internal/impl/descriptors/PossiblyInnerType;)V]
Exception = [java.lang.IllegalArgumentException] (Stacks have different current sizes [0] and [1])
Warning: Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Stacks have different current sizes [0] and [1]
I am using kotlin 1.1.1 (and gradle 3.3, if that matters.)
j
I had some similar errors with kotlin reflect class and proguard, solved adding in the -optimizations
!class/unboxing/enum
My bug was related to this Android Proguard failing with "Value 'i' is not a reference value"
and found the fix in one of the comments

Proguard keep fails about excluded .jar class

I made a simple app with external .jar library.
And going to obfuscator work with ProGuard.
But stuck with errors even had proguard rules.
I don't even know "borken class file" meaning about....
Can anyone know about this problem? Thanks. (Setting options or config attached as bottom section)
# Messages at Android Studio
Error processing C:\Users\administator\Desktop\artest\app\src\main\libs\arsupport.jar:ac.class: broken class file?
Error processing C:\Users\administator\Desktop\artest\app\src\main\libs\arsupport.jar:am.class: broken class file?
...
...
More similar errors...
...
...
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Can't read [C:\Users\administrator\Desktop\artest\app\src\main\libs\arsupport.jar(;;;;;;**/*.class)]
(Can't process class [com/arsec/Programsupport.class] (Unknown verification type [46] in stack map frame))
and ProGuard rules
# proguard-rules.pro
-keep class com.arsec.** { *; }
-keep interface com.arsec.** { *; }
-dontwarn com.arsec.**
I got the same issue in my project,some suggest to reset the value ATTR_StacjMapTable to "dummy" in ClassConstants.java .then repack the proguard.jar
But I solve the problem is get the latest ProGuard in [http://proguard.sourceforge.net the use the latest proguard to make jar. goodlucky

Java.exe exited with code 1. Xamarin

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

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.

Unexpected error when proguard the jsoup in android

My android project have Jsoup(1.6.1) as the external library, but proguard(with the default proguard.cfg generated by ADT) tells there are unexpected errors, such as:
[proguard] Unexpected error while evaluating instruction:
[proguard] Class = [org/jsoup/parser/TreeBuilder]
[proguard] Method = [insertInFosterParent(Lorg/jsoup/nodes/Node;)V]
[proguard] Instruction = [64] aload_2 v2
[proguard] Exception = [java.lang.NullPointerException] (null)
[proguard] Unexpected error while performing partial evaluation:
[proguard] Class = [org/jsoup/parser/TreeBuilder]
[proguard] Method = [insertInFosterParent(Lorg/jsoup/nodes/Node;)V]
[proguard] Exception = [java.lang.NullPointerException] (null)
I have found many posts with the similiar issue for other libraries, and -dontoptimize can remove such errors, but it would degrade the optimization (as the default value in proguard.cfg: -optimizationpasses 5)
Anyone could help me on this? or is it a potential issue of Jsoup?
I had the same issue.
Resolved it by using the latest version of Proguard (4.6) instead of the version bundled with the android sdk (4.4).
This looks like a bug in ProGuard. You should check if it hasn't been fixed in the latest release. Otherwise, you can report the bug on ProGuard's bug tracker at Sourceforge. In this case, the problem may be easy to reproduce. You can probably work around it by reducing the number of optimization passes.

Categories

Resources