Code Monkey home page Code Monkey logo

proguard's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

proguard's Issues

-keepkotlinmetadata doesn't work as expected in version 7.0.0

Problem description

In one of our module we have some Kotlin code that we don't want to obfuscate thus we have this entry in the config:

-keepkotlinmetadata
-keep class org.gradle.kotlin.dsl.** { *; }

This makes the proguard-gradle task complain:

Execution failed for task ':xxx:proguard'.
> Library class [org/gradle/kotlin/dsl/TypeOfExtensionsKt$typeOf$1] doesn't store attributes

This is the file TypeOfExtensions.kt that is "problematic".

As a workaround I found that this piece of configuration actually works:

-keep class kotlin.Metadata { *; }
-keep class org.gradle.kotlin.dsl.** { *; }

TBH I'd expect -keepkotlinmetadata to have exactly the same effect as -keep class kotlin.Metadata { *; } but it's not the case.

Note

It worked all fine in the previous version 6.2.2 - we had neither -keepkotlinmetadata nor -keep class kotlin.Metadata { *; } in our configuration files.

Filename is retraced incorrectly.

We have FragmentManagerImpl:moveToState method in FragmentManager.java file https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/FragmentManager.java#1485

If we have stackrace like

java.lang.RuntimeException: Unable to resume activity {com.example.com/com.example.com.llp.activity.OnlineSessionActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4228)
  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4330)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:148)
  at android.app.ActivityThread.main(ActivityThread.java:7422)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
    at com.android.internal.policy.PhoneWindow.requestFeature(PhoneWindow.java:411)
    at android.app.Dialog.requestWindowFeature(Dialog.java:1491)
    at is.setupDialog(DialogFragment.java:353)
    at is.onGetLayoutInflater(DialogFragment.java:333)
    at androidx.fragment.app.Fragment.performGetLayoutInflater(Fragment.java:1308)
    at ix.a(FragmentManager.java:1460)
    at ix.f(FragmentManager.java:1784)
    at ix.a(FragmentManager.java:1852)
    at ir.g(BackStackRecord.java:802)
    at ix.b(FragmentManager.java:2625)
    at ix.a(FragmentManager.java:2411)
    at ix.b(FragmentManager.java:2366)
    at ix.h(FragmentManager.java:2273)
    at iu.m(FragmentController.java:391)
    at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:517)
...

and in particular line
at ix.a(FragmentManager.java:1460) it deobfuscated as androidx.fragment.app.FragmentManagerImpl(FragmentManagerImpl.java:1460)

While expected behaviour is androidx.fragment.app.FragmentManagerImpl(FragmentManager.java:1460)

6.2.0 produces: java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.

java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.

Exception Details:
Location:
ca/mypackage/one/MyClass$RegistryEntry.getResolvedDefinition()Lca/mypackage/two/MyOtherClass; @52: invokespecial Reason:
Error exists in the bytecode
Bytecode:
0000000: 2ab4 000c 9900 082a b400 0db0 2ab4 000a
0000010: b400 0959 4cc2 2ab4 000d c700 222a 59b4
0000020: 000a 2ab4 000b b600 11b5 000d 2ab4 000a
0000030: 2ab4 000d b700 0e2a 04b5 000c 2bc3 a700
0000040: 084d 2bc3 2cbf 2ab4 000d b0
Exception Handler Table:
bci [22, 62] => handler: 65
bci [65, 68] => handler: 65
Stackmap Table:
same_frame(@12)
append_frame(@60,Object[#6])
full_frame(@65,{Top,Object[#6]},{Object[#8]})
full_frame(@70,{Object[#2]},{})

Property 'keepkotlinmetadata' is not annotated with an input or output annotation

Enabling warnings with latest Gradle reveals some inconsistencies.

tasks.withType<ValidatePlugins> {
    failOnWarning.set(false)
    enableStricterValidation.set(false)
}

will yield

Plugin validation finished with warnings:
  - Warning: Type 'CacheableProguardTask': property 'keepkotlinmetadata' is not annotated with an input or output annotation.

for the new property introduced in 7.0.0:

public boolean keepKotlinMetadata = false;

Logging statements should be supressable

We're using ProGuard for obfuscation only and we're getting a lot of output during build that we would like to be able to silence on demand.

Examples of info output that we would like to be able to mute:

  • Reading library jmod
  • Reading library jar
  • Reading program jar
  • Reading program directory
  • Preparing output jar
  • Copying resources from program jar

And a few warnings that we want to keep for now:

  • Note: duplicate definition of library class

The sources indicate that System.out.println is used currently for displaying these - which are cumbersome to quiet down.
Would it be possible to use SLF4J for the library's logging needs - preferably separating info and warning level logs, as described above.

Wrong result for `x.class.getName()`

Assuming class/interface Abc is obfuscated to a, the call Abc.class.getName() is then changed to a.class.getName() with is incorrect, the result no longer equals.

This still occurred with 6.2.2, I think a better result would optimize it to the result string like Abc, or print a warning when no rule is specified for the class/interface name.

Gradle 6 deprecation warnings

When running ProGuard on Gradle 6, the following deprecation warnings appear:

Property 'configurationFiles' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'inJarCounts' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'inJarFiles' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'inJarFilters' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'libraryJarFiles' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'libraryJarFilters' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'outJarFiles' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'outJarFilters' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'adaptclassstrings' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'adaptresourcefilecontents' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'adaptresourcefilenames' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'addconfigurationdebugging' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'allowaccessmodification' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'android' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontnote' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontobfuscate' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontoptimize' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontpreverify' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontshrink' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontskipnonpubliclibraryclassmembers' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontusemixedcaseclassnames' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dontwarn' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'dump' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'flattenpackagehierarchy' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'forceprocessing' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'ignorewarnings' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'keepattributes' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'keepdirectories' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'keeppackagenames' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'keepparameternames' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'mergeinterfacesaggressively' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'microedition' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'overloadaggressively' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'printconfiguration' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'printmapping' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'printseeds' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'printusage' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'renamesourcefileattribute' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'repackageclasses' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'skipnonpubliclibraryclasses' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'useuniqueclassmembernames' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'verbose' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.

Library interface with generics fails

Hi,

proguard does not recognize interface with gererics in a library. It's implementation method names are then changed.

This interface is in library.jar

public interface MyInterface<T> {
    void setTypedSomething(T var1);

    T getTypedSomething();

    void normalMethod();
}

Implementation class is in in.jar

public class MyImplFail implements MyInterface<MyPojo> {
    MyPojo myPojo;

    public MyImplFail() {
    }

    public void setTypedSomething(MyPojo myPojo) {
        this.myPojo = myPojo;
    }

    public MyPojo getTypedSomething() {
        return this.myPojo;
    }

    public void normalMethod() {
        this.myPojo = null;
    }
}

Proguard result

public final class a implements MyInterface<c> {
    private c a;

    public a() {
    }

    private void a(c var1) {
        this.a = var1;
    }

    private c a() {
        return this.a;
    }

    public final void normalMethod() {
        this.a = null;
    }
}

The problem is the generics. If your implementation uses as a parameter then Proguard works.

public final class b implements MyInterface<Object> {
    private c a;

    public b() {
    }

    public final void setTypedSomething(Object var1) {
        this.a = (c)var1;
    }

    public final Object getTypedSomething() {
        return this.a;
    }

    public final void normalMethod() {
        this.a = null;
    }
}

I have attached a sample project demonstrating this bug here https://sourceforge.net/p/proguard/bugs/765/

Thank you,
Martin

java.lang.VerifyError: Expecting a stackmap frame at branch target 56

When using the suggested workaround from #15 - to add dontpreverify - I get this (with dontoptimize):

Error: Unable to initialize main class com.company.util.DbTools
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 56
Exception Details:
  Location:
    com/company/util/DbTools.main([Ljava/lang/String;)V @2: ifne
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: 2abe 9a00 36b2 009e b801 1eb8 011e b801
    0000010: 1eb8 011e b801 1eb8 011e b801 1eb8 011e
    0000020: b801 1eb8 011e b801 1eb8 011e b801 1eba
    0000030: 0159 0000 b601 10b1 2ab8 00f8 2ab8 00f5
    0000040: 4b2a 0332 4c2b 4d02 3e2c b601 1aab 0000
    0000050: 0000 008c 0000 0006 ce00 38c9 0000 0065
    0000060: eb12 2233 0000 0073 0035 ce71 0000 0057
    0000070: 38b6 e557 0000 003b 3f14 d5ab 0000 0081
    0000080: 5d58 82ba 0000 0049 2c12 27b6 0118 9900
    0000090: 4b03 3ea7 0046 2c12 35b6 0118 9900 3d04
    00000a0: 3ea7 0038 2c12 3eb6 0118 9900 2f05 3ea7
    00000b0: 002a 2c12 43b6 0118 9900 2106 3ea7 001c
    00000c0: 2c12 42b6 0118 9900 1307 3ea7 000e 2c12
    00000d0: 36b6 0118 9900 0508 3e1d aa00 0000 009c
    00000e0: 0000 0000 0000 0005 0000 0026 0000 002c
    00000f0: 0000 0032 0000 0077 0000 008c 0000 0092
    0000100: b800 e6a7 007b b800 f7a7 0075 2ab8 00f5
    0000110: 4b2a b801 2a12 31b9 0151 0200 3604 1504
    0000120: 02a0 0007 2aa7 000d 2a03 1504 b801 2bc0
    0000130: 0046 1504 02a0 0009 b200 9fa7 0010 2a15
    0000140: 0404 602a beb8 012b c000 46b8 00f6 a700
    0000150: 302a b800 f54b 2ab8 00f4 a700 243a 0504
    0000160: b801 1ca7 001b b800 f9a7 0015 2ab8 00f5
    0000170: b800 faa7 000b b200 9d12 1eb6 0110 b1  
  Exception Handler Table:
    bci [342, 346] => handler: 349

And this without dontoptimize:

Error: Unable to initialize main class com.company.util.DbTools
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 56
Exception Details:
  Location:
    com/company/util/DbTools.main([Ljava/lang/String;)V @2: ifne
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: 2abe 9a00 36b2 009e b801 16b8 0116 b801
    0000010: 16b8 0116 b801 16b8 0116 b801 16b8 0116
    0000020: b801 16b8 0116 b801 16b8 0116 b801 16ba
    0000030: 0151 0000 b601 08b1 2a59 4cbe 9d00 0eb2
    0000040: 009d 1220 b601 08a7 0031 2b03 3203 bd00
    0000050: 7db8 0143 b901 4501 00b6 011f b800 b2a7
    0000060: 0019 4db2 009d 2b03 32ba 016b 0000 b601
    0000070: 082c b200 9db6 011d 2ab8 00f0 594b 0332
    0000080: 4c02 3d2b b601 12ab 0000 008a 0000 0006
    0000090: ce00 38c9 0000 0063 eb12 2233 0000 0071
    00000a0: 0035 ce71 0000 0055 38b6 e557 0000 0039
    00000b0: 3f14 d5ab 0000 007f 5d58 82ba 0000 0047
    00000c0: 2b12 27b6 0110 9900 4b03 3da7 0046 2b12
    00000d0: 35b6 0110 9900 3d04 3da7 0038 2b12 3eb6
    00000e0: 0110 9900 2f05 3da7 002a 2b12 43b6 0110
    00000f0: 9900 2106 3da7 001c 2b12 42b6 0110 9900
    0000100: 1307 3da7 000e 2b12 36b6 0110 9900 0508
    0000110: 3d1c aa00 0000 02f3 0000 0000 0000 0005
    0000120: 0000 0026 0000 004a 0000 0057 0000 0095
    0000130: 0000 02bf 0000 02eb b800 f312 67b6 010b
    0000140: 4cbb 0099 59b7 012f 2bba 016c 0000 b601
    0000150: 3057 b800 a4b1 4db8 00a4 2cbf b200 9db8
    0000160: 00dc b400 9ab6 0107 b12a b800 f059 4bb8
    0000170: 0122 1231 b901 4902 0059 3c02 a000 072a
    0000180: a700 0c2a 031b b801 23c0 0046 1b02 a000
    0000190: 09b2 009f a700 0f2a 1b04 602a beb8 0123
    00001a0: c000 46b8 00f1 b12a b800 f04b 2a4c b800
    00001b0: dd4d 1243 01b8 00bf 57bb 0065 59b7 00da
    00001c0: b801 2dbb 0052 592c b700 b559 4bb8 00e4
    00001d0: 594e 1240 b600 c3c0 005a 3a04 bb00 5259
    00001e0: 2c12 2612 24b9 013a 0300 b700 b559 3a05
    00001f0: 1224 1904 b901 3201 00b8 00e7 1905 1904
    0000200: b901 3201 002d 1241 b600 c3c0 008e b800
    0000210: e8b8 00a3 b601 054e 1006 bd00 7c59 0312
    0000220: 0453 5904 2c12 29b9 013d 0200 5359 0512
    0000230: 0353 5906 123b 5359 0712 0253 5908 2db9
    0000240: 0144 0100 53b8 00d9 3a04 1239 1904 b800
    0000250: d8a7 0015 593a 04b2 009d b601 06b8 012c
    0000260: b801 2e19 04bf bb00 5259 2c12 2612 25b9
    0000270: 013a 0300 b700 b53a 0419 05b8 00e5 3a06
    0000280: 1904 b800 e53a 042b b801 25b8 00cd ba01
    0000290: 6d00 00ba 016e 0000 b901 5004 00c0 0060
    00002a0: b600 d04c 1904 1906 1905 2a2b b800 e912
    00002b0: 2b06 bd00 7c59 0312 2553 5904 1224 5359
    00002c0: 0512 2553 b801 114b 06bd 007c 5903 2c12
    00002d0: 29b9 013d 0200 5359 0412 0153 5905 2a53
    00002e0: b800 d94c 1238 2bb8 00d8 b801 2cb8 012e
    00002f0: 2db8 00c7 b14b b200 9d12 11b6 0108 2ab2
    0000300: 009d b601 06b1 594b b200 9db6 0118 06bd
    0000310: 007c 5903 2c12 29b9 013d 0200 5359 0412
    0000320: 0153 5905 122c 53b8 00d9 4c12 382b b800
    0000330: d8a7 0013 4cb2 009d 1212 b601 082b b200
    0000340: 9db6 0106 2db9 0144 0100 05bd 007d 5903
    0000350: 2c12 29b9 013d 0200 c000 7d53 5904 123c
    0000360: 53b8 0143 4e08 bd00 7c59 0312 0453 5904
    0000370: 2c12 29b9 013d 0200 5359 0512 0353 5906
    0000380: 123b 5359 072d b901 4401 0053 b800 d94c
    0000390: 123a 2bb8 00d8 a700 134c b200 9d12 13b6
    00003a0: 0108 2bb2 009d b601 062a bf4b b801 2cb8
    00003b0: 012e 2db8 00c7 a700 134c b200 9d12 11b6
    00003c0: 0108 2bb2 009d b601 062a bf57 04b8 0114
    00003d0: b1b8 00f3 b200 9b12 16b8 00be b600 a7b8
    00003e0: 00b1 59b8 012a 57ba 016f 0000 b600 fcb6
    00003f0: 00fa 57b8 00a4 b14c b800 a42b bf2a b800
    0000400: f0b8 00f2 b1b2 009d 121e b601 08b1     
  Exception Handler Table:
    bci [74, 95] => handler: 98
    bci [315, 338] => handler: 342
    bci [536, 593] => handler: 596
    bci [752, 756] => handler: 757
    bci [676, 746] => handler: 774
    bci [782, 817] => handler: 820
    bci [836, 918] => handler: 921
    bci [676, 746] => handler: 939
    bci [946, 950] => handler: 953
    bci [774, 940] => handler: 939
    bci [980, 1011] => handler: 1015
    bci [428, 971] => handler: 971

Any ideas what might be wrong?

Java 14 support

When I try obfuscating with Java 14 get the following:

Unsupported version number [58.0] (maximum 57.0, Java 13)

I'm guessing proguard doesn't yet support Java 14

Parameterless constructor might be made private when another constructor has its parameters removed

When a class has multiple constructors it can happen that for some of them, unused parameters are removed. When several constructors have the same descriptor afterwards, ProGuard has to fix that by introducing some synthetic parameters to distinguish them from another.

Now this can lead to situations where the constructor whose parameter has been removed will become the new parameterless constructor, and the original constructor has some additional parameter.

This can have multiple effects: the original parameterless constructor might be made private, and a different constructor might be called when the class is dynamically created.

A simple example to illustrate the problem is this kotlin class:

class MyService(
private val foo: String = "bar",
private val bar: Intent = Intent()
) : Service() {
override fun onBind(intent: Intent?): IBinder? = null
}

As there are default values, the kotlin compiler will create additional synthetic constructors whose parameters might get removed.

When using Proguard on the class with optimization enabled, the original parameterless constructor is made private.

java.lang.ClassFormatError: Conflicting NestHost and NestMembers attributes in class file

We are using pro guard for many years now. Just recently (after we upgraded our codebase to use OpenJDK 13) we are experiencing runtime errors caused by NestHost and NestMembers attributes:

java.lang.ClassFormatError: Conflicting NestHost and NestMembers attributes in class file

It is very hard to create a minimal example, but I just would like to report this bug and hope that someone has an idea how it could be fixed.

After upgrading android build:gradle:4.0.0 shows me error in proguard

After upgrading android build:gradle:4.0.0 shows me Unresolved class name error in proguard.

-keep class rx.** { *; } // unresolve
-keep class org.apache.** {*;} // unresolve
-keep class org.apache.http.** { *; } // unresolve
-keep class org.apache.james.mime4j.** { *; } // unresolve
-dontwarn retrofit2.Platform$Java8 // error at $ sign

NullPointerException in AttributeNameFilter.visitCodeAttribute

I recently attempted to add Proguard minifcation and obfuscation to our Android project, I am getting the following exception in an Android project, using version 6.2.0

Caused by: java.lang.NullPointerException
        at proguard.classfile.attribute.visitor.AttributeNameFilter.visitCodeAttribute(AttributeNameFilter.java:286)

Some additional metadata around what is failing would be appreciated. Unfortunately, I am unable to share the source of the project, as that information is proprietary.

Note: the issue does not occur with R8 - just ProGuard.

Full stack trace

> Task :sample:transformClassesAndResourcesWithProguardForSourceMockInsecureRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sample:transformClassesAndResourcesWithProguardForSourceMockInsecureRelease'.
> java.io.IOException: java.lang.NullPointerException

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sample:transformClassesAndResourcesWithProguardForSourceMockInsecureRelease'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
        at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
        at org.gradle.api.internal.tasks.execution.StartSnapshotTaskInputsBuildOperationTaskExecuter.execute(StartSnapshotTaskInputsBuildOperationTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
        at org.gradle.execution.plan.DefaultPlanExecutor.process(DefaultPlanExecutor.java:74)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.executeWithServices(DefaultTaskExecutionGraph.java:178)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:154)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:41)
        at org.gradle.execution.DefaultBuildWorkExecutor.execute(DefaultBuildWorkExecutor.java:40)
        at org.gradle.execution.DefaultBuildWorkExecutor.access$000(DefaultBuildWorkExecutor.java:24)
        at org.gradle.execution.DefaultBuildWorkExecutor$1.proceed(DefaultBuildWorkExecutor.java:48)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
        at org.gradle.execution.DefaultBuildWorkExecutor.execute(DefaultBuildWorkExecutor.java:40)
        at org.gradle.execution.DefaultBuildWorkExecutor.execute(DefaultBuildWorkExecutor.java:33)
        at org.gradle.execution.IncludedBuildLifecycleBuildWorkExecutor.execute(IncludedBuildLifecycleBuildWorkExecutor.java:36)
        at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor$ExecuteTasks.run(BuildOperationFiringBuildWorkerExecutor.java:56)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor.execute(BuildOperationFiringBuildWorkerExecutor.java:41)
        at org.gradle.initialization.DefaultGradleLauncher.runWork(DefaultGradleLauncher.java:236)
        at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:147)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:126)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:106)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:60)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:57)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:85)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:78)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:189)
        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:78)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:57)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
        at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:68)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:27)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.RuntimeException: java.io.IOException: java.lang.NullPointerException
        at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:108)
        at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
        at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:93)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:237)
        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
        at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208)
        at org.gradle.internal.execution.steps.CacheStep.executeAndStoreInCache(CacheStep.java:187)
        at org.gradle.internal.execution.steps.CacheStep.lambda$executeWithCache$2(CacheStep.java:110)
        at org.gradle.internal.execution.steps.CacheStep.lambda$executeWithCache$3(CacheStep.java:110)
        at org.gradle.internal.Try$1.apply(Try.java:59)
        at org.gradle.internal.Try$1.apply(Try.java:56)
        at org.gradle.internal.Try$Success.flatMap(Try.java:102)
        at org.gradle.internal.Try.map(Try.java:56)
        at org.gradle.internal.execution.steps.CacheStep.executeWithCache(CacheStep.java:79)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:69)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
        at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
        at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140)
        ... 129 more
Caused by: java.io.IOException: java.lang.NullPointerException
        at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:261)
        at com.android.build.gradle.internal.transforms.ProGuardTransform.lambda$transform$0(ProGuardTransform.java:180)
        at com.android.build.gradle.internal.tasks.WorkLimiter.limit(WorkLimiter.kt:38)
        at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:178)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:106)
        ... 191 more
Caused by: java.lang.NullPointerException
        at proguard.classfile.attribute.visitor.AttributeNameFilter.visitCodeAttribute(AttributeNameFilter.java:286)
        at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:141)
        at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:101)
        at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
        at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:93)
        at proguard.classfile.visitor.MultiMemberVisitor.visitProgramMethod(MultiMemberVisitor.java:74)
        at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:93)
        at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:588)
        at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
        at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:67)
        at proguard.classfile.ProgramClass.accept(ProgramClass.java:430)
        at proguard.classfile.ProgramClass.hierarchyAccept(ProgramClass.java:443)
        at proguard.classfile.visitor.ClassHierarchyTraveler.visitProgramClass(ClassHierarchyTraveler.java:75)
        at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:67)
        at proguard.classfile.ProgramClass.accept(ProgramClass.java:430)
        at proguard.classfile.ClassPool.classAccept(ClassPool.java:157)
        at proguard.classfile.visitor.NamedClassVisitor.visitClassPool(NamedClassVisitor.java:47)
        at proguard.classfile.visitor.MultiClassPoolVisitor.visitClassPool(MultiClassPoolVisitor.java:85)
        at proguard.classfile.ClassPool.accept(ClassPool.java:110)
        at proguard.DescriptorKeepChecker.checkClassSpecifications(DescriptorKeepChecker.java:84)
        at proguard.Initializer.execute(Initializer.java:305)
        at proguard.ProGuard.initialize(ProGuard.java:271)
        at proguard.ProGuard.execute(ProGuard.java:113)
        at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:66)
        at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:255)
        ... 197 more


"Can't find common super class of" error after upgrade to Java 11

I just switched the version of Java in my project from 8 to 11 and now I have problems with Proguard 6.2.2 and sbt-proguard 0.3.0 with the following options:

-dontnote,
-dontwarn,
-dontoptimize,
-dontusemixedcaseclassnames,
-keep public class org.slf4j.** { *; },
-keep public class ch.** { *; },
-keep class org.bouncycastle.** { *; },
-keepnames public class * {
  public static ** classTag();
  },
-keepclasseswithmembers public class * {
   public static void main(java.lang.String[]);
  },
-keepclassmembers class * {
  ** MODULE$;
  },
-keepclasseswithmembernames,includedescriptorclasses class * {
  native <methods>;
  },
-keepclassmembers,allowoptimization enum * {
  public static **[] values();
  public static ** valueOf(java.lang.String);
  },
-keepattributes SourceFile,LineNumberTable

And here's the stacktrace:

Unexpected error while performing partial evaluation:
   Class       = [akka/actor/ActorSelection$$anonfun$1]
   Method      = [applyOrElse(Ljava/lang/String;Lscala/Function1;)Ljava/lang/Object;]
   Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [akka/actor/SelectChildPattern] (with 1 known super classes) and [akka/actor/SelectChildName] (with 1 known super classes))
 Unexpected error while preverifying:
   Class       = [akka/actor/ActorSelection$$anonfun$1]
   Method      = [applyOrElse(Ljava/lang/String;Lscala/Function1;)Ljava/lang/Object;]
   Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [akka/actor/SelectChildPattern] (with 1 known super classes) and [akka/actor/SelectChildName] (with 1 known super classes))
 Error: Can't find common super class of [akka/actor/SelectChildPattern] (with 1 known super classes) and [akka/actor/SelectChildName] (with 1 known super classes)
 java.lang.RuntimeException: Proguard failed with exit code [1]
   at scala.sys.package$.error(package.scala:30)
   at com.lightbend.sbt.SbtProguard$.runProguard(SbtProguard.scala:114)
   at com.lightbend.sbt.SbtProguard$.$anonfun$proguardTask$2(SbtProguard.scala:94)
   at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:73)
   at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:146)
   at sbt.util.Difference.apply(Tracked.scala:323)
   at sbt.util.Difference.apply(Tracked.scala:303)
   at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:142)
   at sbt.util.Difference.apply(Tracked.scala:323)
   at sbt.util.Difference.apply(Tracked.scala:298)
   at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:141)
   at com.lightbend.sbt.SbtProguard$.$anonfun$proguardTask$1(SbtProguard.scala:98)
   at scala.Function1.$anonfun$compose$1(Function1.scala:49)
   at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
   at sbt.std.Transform$$anon$4.work(Transform.scala:67)
   at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
   at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
   at sbt.Execute.work(Execute.scala:290)
   at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
   at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
   at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at java.base/java.lang.Thread.run(Thread.java:834)

I tried to add these options with no luck:

-keep class akka.actor.** { *; },
-keep interface akka.actor.** { *; },
-keep enum akka.actor.** { *; },
-keep class akka.actor.SelectChildPattern { *; },
-keep class akka.actor.ActorSelection { *; },
-keep class akka.actor.SelectChildName { *; }

I can see that Akka is in library jars:

[debug] -libraryjars "/Users/izhavoronkov/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.12/2.5.26/akka-actor_2.12-2.5.26.jar"

Also, if I set -dontpreverify, I can find the missing Akka classes inside the jar and they're not obfuscated as expected. Have no idea what's wrong with proguard or config.

And I don't have these problems with Java 8.

Gradle Plugin

The docs at https://www.guardsquare.com/en/products/proguard/manual/gradleplugin state;

ProGuard Gradle Plugin
Alternatively, you can enable ProGuard in the Android Gradle build process using ProGuard's own tuned plugin, by changing the build.gradle file of your project as follows: ...

Well, I followed the instructions, and Gradle fails with message "Plugin with id 'proguard' not found".

I tried compiling the included android-plugin example, and it fails with same message.

I am using Android Studio 3.5.1, Gradle 5.4.1, and 'com.android.tools.build:gradle:3.5.1'

Is this a bug, or a mistake in the documentation?

Support Gradle reproducible builds

In Gradle 3.4, support was added for reproducible builds. https://docs.gradle.org/3.4/userguide/working_with_files.html#sec:reproducible_archives

The ProGuardTask is not a AbstractArchiveTask, and so using the recommended way of achieving reproducible builds is not possible.

This feature request is to enable reproducible builds when using ProGuard. Ideally, it would be possible to do so using the recommended Gradle mechanism, but if a custom configuration is required, that is acceptable as well.

java.lang.VerifyError: Bad type on operand stack in putfield

ProGuard version 6.2.2 but this has been happening for a while now with older versions too.

This is when optimizations are on. With dontoptimize this error is gone. This is the full error:

java.lang.VerifyError: Bad type on operand stack in putfield
Exception Details:
  Location:
    com/company/fj.<init>(Ljava/lang/String;Z)V @6: putfield
  Reason:
    Type 'com/company/fj' (current frame, stack[0]) is not assignable to 'com/company/rest/b' (constant pool 29)
  Current Frame:
    bci: @6
    flags: { }
    locals: { 'com/company/fj', 'java/lang/String', integer }
    stack: { 'com/company/fj', 'java/lang/String' }
  Bytecode:
    0000000: 2ab7 002c 2a2b b500 1d2a 1cb5 001e b1  

Here is my configuration options:

	target '13'
	overloadaggressively
	allowaccessmodification
	mergeinterfacesaggressively
	keepparameternames
	optimizationpasses 5
	dontshrink
	dontusemixedcaseclassnames
	repackageclasses 'com.company'

Not sure how I can help with this. What information do you need from me?

Incorrect deobfuscation for stacktraces

The method name for the following obfuscated stacktrace was not deobfuscated correctly -
Obfuscated stacktrace - at com.boxer.e.ad.a(SourceFile:2072)

Deobfuscated stacktrace - com.boxer.injection.DaggerBoxerObjectGraph.a(DaggerBoxerObjectGraph.java:2072)

Mapping file -
com.boxer.injection.DaggerBoxerObjectGraph -> com.boxer.e.ad:
com.boxer.exchange.syncstrategyadapter.EmailBodySizeAdapterModule emailBodySizeAdapterModule -> a

Also, is there a way to identify if a stacktrace has been obfuscated using Proguard using only the stacktrace?

Unexpected error while preverifying

Hello,

I am having issues with proguard.

[proguard] Unexpected error while performing partial evaluation: [proguard] Class = [org/mineacademy/chatcontrol/final/nul/ /f] [proguard] Method = [a()V] [proguard] Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [org/mineacademy/chatcontrol/a] (with 3 known super classes) and [org/mineacademy/chatcontrol/api/event/PrePrivateMessageEvent] (with 1 known super classes)) [proguard] Unexpected error while preverifying: [proguard] Class = [org/mineacademy/chatcontrol/final/nul/ /f] [proguard] Method = [a()V] [proguard] Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [org/mineacademy/chatcontrol/a] (with 3 known super classes) and [org/mineacademy/chatcontrol/api/event/PrePrivateMessageEvent] (with 1 known super classes)) [proguard] Error: Can't find common super class of [org/mineacademy/chatcontrol/a] (with 3 known super classes) and [org/mineacademy/chatcontrol/api/event/PrePrivateMessageEvent] (with 1 known super classes)

proguard.conf: https://pastebin.com/SwRUjKK7
pom.xml: https://pastebin.com/zSt0afSG

How do I fix this?

Thank you for you answer.

Sincerely,
Ladislav

Optimizing crashes my program

Hello, I am with a problem that if I leave the optimizer on, the program does not work properly when connecting with a lib on Java.
It only works properly after -dontoptimize
I don't have a problem with obfuscating or shrinking, only optimize.

What's the best way to figure out the error? I want to use optimize

Thanks

ApplyMapping is not happening properly during obfuscation

While trying to obfuscate a jar using proguard-anttask, despite providing an input map file on how the classes have to named after obfuscation using applymapping property, certain methods and fields are not renamed as per the input map file.

For example, in my case I have a jar J1 and it depends on another jar J2, I usually bundle these 2 together and build my resultant jar J3.

I have .map files created from the earlier proguard obfuscation runs for J1 and J2. Now, I merge the .map files together as a single one and feed as input for obfuscating J3 using "applymapping" property

But, certain methods and fields (not all) of J2 are not getting renamed as expected

I tried replacing J1 with a different jar say J4, added the same dependant jar J2 again and repeated the same steps. The resultant jar J5 is having a new set of methods of J2 unobfuscated.

Infinite optimize loop if optimizationpasses was set to 10000

Version: proguard6.1.1
javaSandbox.zip

This example provides infinite loop.

Infinite out:

Shrinking...
Removing unused program classes and class elements...
Original number of program classes: 2
Final number of program classes: 2
Optimizing (pass 221/10000)...
Number of finalized classes: 0
Number of unboxed enum classes: 0
Number of vertically merged classes: 0
Number of horizontally merged classes: 0
Number of merged wrapper classes: 0
Number of removed write-only fields: 1
Number of privatized fields: 0
Number of inlined constant fields: 0
Number of privatized methods: 0
Number of staticized methods: 0
Number of finalized methods: 0
Number of desynchronized methods: 0
Number of simplified method signatures: 0
Number of removed method parameters: 0
Number of inlined constant parameters: 0
Number of inlined constant return values: 0
Number of inlined short method calls: 0
Number of inlined unique method calls: 0
Number of inlined tail recursion calls: 0
Number of merged code blocks: 0
Number of variable peephole optimizations: 0
Number of arithmetic peephole optimizations: 0
Number of cast peephole optimizations: 0
Number of field peephole optimizations: 0
Number of branch peephole optimizations: 0
Number of object peephole optimizations: 0
Number of string peephole optimizations: 0
Number of math peephole optimizations: 0
Number of simplified instructions: 0
Number of removed instructions: 0
Number of removed local variables: 0
Number of removed exception blocks: 0
Number of optimized local variable frames: 0

5.3.2 to 6.2.0. JNI error: Constructor must call super() or this() before return

Hello.

I'm migrating from 5.3.2 to 6.2.0 proguard. And I have found following error:


Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.VerifyError: Constructor must call super() or this() before return
Exception Details:
  Location:
    com/HelloWorld.<init>()V @0: return
  Reason:
    Error exists in the bytecode
  Bytecode:
    0x0000000: b1

        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

5.3.2 version works fine.

Replacing assumenosideeffects to assumenoexternalsideeffects removes the error but it produces unexpected output:

new StringBuilder("greet ").append("string1").append(" ").append("string2");

proguardConstructorSideEffects.zip

Which config must be used to preserve 5.3.2 behavior?

[7.0.0] Unnecessary dependency on com.android.tools.build

Thank you for releasing ProGuard 7 with Java 14 support!

One thing which I find strange (and perhaps can be improved on ProGuard's side) is the dependency on com.android.tools.build:gradle:3.0.0. Just updating ProGuard's version to 7.0.0 (and changing the artifact ID) leads to a Could not find com.android.tools.build:gradle:3.0.0. error. I had to add google() as a repository for my build script to resolve that.

I'm developing a Java server application which has absolutely nothing to do with Android so a dependency on something with android in the name seems unneeded.

can proguard read <java.home>/lib/modules from openjdk-14?

although proguard reports

Reading library directory [/usr/lib/jvm/java-14-openjdk-14.0.1.7-2.rolling.fc32.x86_64/lib/modules] (filtered)
Initializing...

there are alot of

Note: the configuration refers to the unknown class 'java.lang.String'
Note: the configuration refers to the unknown class 'java.sql.Driver'
Note: the configuration refers to the unknown class 'java.lang.System'

and proguard fails at the end.

jimage extract --dir=rt /lib/jvm/java/lib/modules and using -libraryjars rt/java.base within the config file works around the problem, but this feels not quite right.

Ant task.properties

Hi all,
I've been using proguard for years in Eclipse projects with Ant task.
It seems like ant folder and task.properties haven't been included in the proguard.jar version 7.0.0.

[taskdef] Could not load definitions from resource proguard/ant/task.properties. It could not be found.

Is Ant task supported in proguard 7?

Best Regards

Gianluca

ERROR: Plugin with id 'proguard' not found.

I've initially tried to run a locally stored Proguard version and have followed the guidelines as mentioned in the manual.

In my project build.gradle:

buildscript { repositories { flatDir dirs: '<PATH_TO_PROGUARD_LOCAL_LIB_DIR>' ... } dependencies { ... classpath 'com.android.tools.build:gradle:GRADLE_VERSION' classpath ':proguard:' ... } }

And in my module build.gradle:

apply plugin: 'com.android.application' apply plugin: 'proguard'

However, when running the Gradle project sync, I ran into the following error:
ERROR: Plugin with id 'proguard' not found.

First, I thought it was due to some configurations within my project but I've tried the default project included in the source at proguard/examples/android-plugin and still got the same error.

ProGuard status?..

Hello. I'm trying to shrink a JavaFX application and the last public version of ProGuard, 6.3.0beta1 (I use Gradle task), says it supports only Java 10 bytecode. But, according to the source code, ProGuard supports even Java 14.
What's the status of ProGuard project, will there be a release?
Thanks.

5.3.3 to 6.0.3: Value "f" is not a reference value (UnknownFloatValue)

We had to update our proguard version but now we get a strange error. Any idea how to fix it, or is it a proguard issue?
The lib is https://repository.jboss.org/maven2/javax/media/jai-core/1.1.3/jai-core-1.1.3.jar

[proguard] Unexpected error while evaluating instruction:
[proguard] Class = [com/sun/media/jai/opimage/ImageFunctionOpImage]
[proguard] Method = [computeRect([Ljavax/media/jai/PlanarImage;Ljava/awt/image/WritableRaster;Ljava/awt/Rectangle;)V]
[proguard] Instruction = [357] aaload
[proguard] Exception = [java.lang.IllegalArgumentException] (Value "f" is not a reference value [proguard.evaluation.value.UnknownFloatValue])
[proguard] Unexpected error while performing partial evaluation:
[proguard] Class = [com/sun/media/jai/opimage/ImageFunctionOpImage]
[proguard] Method = [computeRect([Ljavax/media/jai/PlanarImage;Ljava/awt/image/WritableRaster;Ljava/awt/Rectangle;)V]
[proguard] Exception = [java.lang.IllegalArgumentException] (Value "f" is not a reference value [proguard.evaluation.value.UnknownFloatValue])
[proguard] Error: java.lang.IllegalArgumentException: Value "f" is not a reference value [proguard.evaluation.value.UnknownFloatValue]

java.lang.VerifyError: Constructor must call super() or this() before return

Hi, after processing this code with proguard version starts with 6.0+(5.3.3 works fine) i got this exception.

java.lang.VerifyError: Constructor must call super() or this() before return
Exception Details:
  Location:
    com/example/TestSingletone.<init>()V @0: return
  Reason:
    Error exists in the bytecode
  Bytecode:
    0x0000000: b1

example

public class TestSingletone {

    private static TestSingletone singletone;

    public static synchronized TestSingletone getInstance() {
        if (singletone == null) {
            singletone = new TestSingletone();
        }

        return singletone;
    }

    private TestSingletone() {

    }

}

after call TestSingletone.getInstance() i've got a VerifyError.

my proguard config

-target 1.8

-keep public class com.example.TestSingletone {
    public <fields>;
    protected <fields>;
    public <methods>;
}

-assumenosideeffects public class java.lang.String {
    public <init>();
}

java version is

openjdk version "1.8.0_232"
OpenJDK Runtime Environment (Zulu 8.42.0.23-CA-win64) (build 1.8.0_232-b18)
OpenJDK 64-Bit Server VM (Zulu 8.42.0.23-CA-win64) (build 25.232-b18, mixed mode)

javac version is
javac 1.8.0_232

Could you please look to this?

v6.0.3 java.lang.ArrayIndexOutOfBoundsException: -1

java.lang.ArrayIndexOutOfBoundsException: -1
at proguard.evaluation.Stack.getTop(Stack.java:216)
at proguard.optimize.info.ParameterEscapeMarker.markEscapingParameters(ParameterEscapeMarker.java:457)
at proguard.optimize.info.ParameterEscapeMarker.visitParameter(ParameterEscapeMarker.java:427)
at proguard.classfile.util.AllParameterVisitor.visitParameters(AllParameterVisitor.java:178)
at proguard.classfile.util.AllParameterVisitor.visitProgramMethod(AllParameterVisitor.java:72)
at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:93)
at proguard.classfile.ProgramMember.accept(ProgramMember.java:125)
at proguard.classfile.constant.RefConstant.referencedMemberAccept(RefConstant.java:126)
at proguard.optimize.info.ParameterEscapeMarker.visitAnyMethodrefConstant(ParameterEscapeMarker.java:408)

Optimization info for removed parameters is not updated correctly

When optimizing parameters of methods might get removed.

After unused parameters have been removed their corresponding optimization info must be removed as well.

For this purpose the UnusedParameterOptimizationInfoUpdater is used. Unfortunately it uses an AllParameterVisitor to visit all parameters. This one uses internally the descriptor of the method to traverse all parameters. Unfortunately, at this stage, the descriptor is already updated, thus not all parameters are visited.

If a parameter at the end is removed, there is no problem, but if parameters with arbitrary indexes are removed, there are inconsistencies.

The code can not used an AllParameterVisitor, but in fact has to traverse all parameters similar to the ParameterShrinker executed right before it.

Having keyword replaced with different keywords for each instance within class

Is there a way to have keywords of the same class replaced by the same string?

I have the following code
Before obfuscation:
public class ABC { private List<DEF> results = new ArrayList<DEF>(); public List<DEF> results() { return this.results; } public void results_$eq(List<DEF> x$1) { this.results = x$1; } }

After obfuscation:

public class a { private List<b> kt = new ArrayList<b>(); public List<b> fO() { return this.kt; } public void b(List<b> paramList) { this.kt = paramList; } }

Is there a way that proguard obfuscates to
public class a { private List<b> kt = new ArrayList<b>(); public List<b> kt() { return this.kt; } public void kt(List<b> paramList) { this.kt = paramList; } }

Using Proguard's gradle plugin without Android target

I want to use proguard to minify a fat jar more or less as you do it for Android, byside my target is not Android.

I get a crash when applying the plugin in ProGuardPlugin.groovy line 47 with a NoClassDefFoundError, because you are throwing a BadPluginException when the Android plugin was not detected (which is itself part of the Android Plugin).

Could you extend your plugin to remove the hard dependency on the Android plugin?

Proguard 6.2.2: shrink dont work with some interfaces

Hello, shrink dont work completly with the library fastutil (http://fastutil.di.unimi.it), leaving in the output jar unused classes.

Im using openjdk 13.0.2 and proguard 6.2.2.

After some tests, the problem seems be when an interface method is overrided.

public interface BooleanSetOk extends java.util.Set<Boolean>
{
	boolean add2(Boolean aBoolean);
}

public interface BooleanSetFail extends java.util.Set<Boolean>
{
	@Override
	boolean add(Boolean aBoolean);
}

The first class is removed, but the second don't.

java.lang.ClassFormatError: Invalid pc in LineNumberTable in class file

We include Groovy in our build and updating its version from 2.5.4 to 2.5.5 (and any above) leads to the following exception when we run the build:

Exception in thread "main" java.lang.ClassFormatError: Invalid pc in LineNumberTable in class file com/company/util/d
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:823)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:721)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:644)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at com.company.util.DbTools.a(SourceFile:204)
	at com.company.util.DbTools.main(SourceFile:114)

Searching through the "old" issue tracker I found just this similar issue, not sure if it is related.

I found this because we used the Groovy version that comes with Gradle and they updated it from 2.5.4 to 2.5.8 in Gradle 6 which broke the builds we make.

This is kind of a show-stopper for us because Groovy < 2.5.7 doesn't work with Java 13.

I could try creating a reproduction if you can't figure out what's going on.

Stack size becomes negative after instruction pop in

I have got crash when compile release version with proguard:

Unexpected error while computing stack sizes:
  Class       = [com/olekdia/androidcommon/extensions/PowerExtensionsKt]
  Method      = [acquireCpu(Landroid/content/Context;Ljava/lang/String;J)V]
  Exception   = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [136] pop in [com/olekdia/androidcommon/extensions/PowerExtensionsKt.acquireCpu(Landroid/content/Context;Ljava/lang/String;J)V])

Here is a kotlin code:

private val wakeLockMap = SimpleArrayMap<String, PowerManager.WakeLock>(0)

@SuppressLint("WakelockTimeout")
fun Context.acquireCpu(
    tag: String,
    timeout: Long = INFINITE_TIMEOUT
) {
    synchronized(wakeLockMap) {
        wakeLockMap.get(tag)
            ?.apply {
                if (!isHeld) {
                    if (timeout == INFINITE_TIMEOUT) acquire() else acquire(timeout)
                }
            }
            ?: run {
                this.powerManager
                    ?.newWakeLock(
                        PowerManager.PARTIAL_WAKE_LOCK or PowerManager.ON_AFTER_RELEASE,
                        tag
                    )
                    ?.apply {
                        if (timeout == INFINITE_TIMEOUT) acquire() else acquire(timeout)
                        wakeLockMap.put(tag, this)
                    }
            }
    }
}

Gradle v 6.0.1

Proguard replaces Methodref to InterfaceMethodref, but does not change instructions

Hello.
We are using this awesome framework for our needs (https://github.com/SpongePowered/Mixin) and everything works fine.

However, Proguard breaks valid bytecode after obfuscation.
Before Proguard:

00000000 : aload_0
00000001 : invokevirtual       java.util.List hh.a()
00000004 : areturn

cp
After Proguard:
cp2

We will attempt to fix that issue in Mixin framework, however, can Proguard:
a) Also change instructions?
b) Don't touch constant pool in that case?
Thanks.

P.S The problem is that INVOKEVIRTUAL requires Methodref, not InterfaceMethodref. That change triggers JVM's verifier.

 java.lang.VerifyError: Illegal type at constant pool entry 6 in class hh
             Exception Details:
                Location:
                  hh.appendSibling(Lhh;)Lhh; @2: invokevirtual
                Reason:
                  Constant pool index 6 is invalid
                Bytecode:
                  0x0000000: 2a2b b600 06b0                         
                  	at qs.a(Unknown Source)
                  	at vi$a.<init>(Unknown Source)
                  	at vi.a(Unknown Source)
                  	at vi.c(Unknown Source)
                  	at ni.c(Unknown Source)
                  	at bib.<init>(Unknown Source)

Broken pre-made gradle build configurations

Hello,
the following lines cause issues when trying to run:

keepattributes 'Exceptions,InnerClasses,Signature,Deprecated,'
SourceFile,LineNumberTable,EnclosingMethod

I think this should be keepattributes 'Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod' (at least it works for me).
This is totally broken:
keepclasseswithmembernames,includedescriptorclasses 'class * { \

It works only for me if I remove ,includedescriptorclasses.
I couldn't figure out a way yet to still apply the keep modifier includedescriptorclasses. As far as I looked it up, this bug is found in almost every pre-made gradle build file.

I/dalvikvm: Could not find method java.util.Map.getOrDefault, referenced from method d.l.a.y.a.a$b.a

The proguard is set to

buildscript {
    configurations.all {
        resolutionStrategy {
            force 'net.sf.proguard:proguard-gradle:6.2.0'
        }
    }
}
buildTypes {
        debug { //Debug release
            minifyEnabled true
            shrinkResources true
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //Doesn't matter
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            if (keystorePropertiesFile.exists()) {
                signingConfig signingConfigs.config
            }
        }

And R8 is enabled and moshi version is 1.9.0
Kotlin 1.3.61
AS 3.5.2
Gradle plugin: 3.5.2

Error:

W/dalvikvm: DexOpt: method is in an interface
I/dalvikvm: Could not find method java.util.Map.getOrDefault, referenced from method d.l.a.y.a.a$b.a
W/dalvikvm: VFY: unable to resolve virtual method 64691: Ljava/util/Map;.getOrDefault (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    VFY:  rejecting opcode 0x6f at 0x0000
    VFY:  rejected Ld/l/a/y/a/a$b;.a (Lh/d0/k;Ljava/lang/Object;)Ljava/lang/Object;
    Verifier rejected class Ld/l/a/y/a/a$b;
D/dalvikvm: GC_FOR_ALLOC freed 1895K, 16% free 10874K/12872K, paused 9ms, total 10ms

proguard-rules.pro:

-printconfiguration "build/outputs/mapping/configuration.txt"

-keepattributes Signature
-keepattributes Exceptions
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable

-dontwarn okhttp3.**
-dontwarn retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn org.jetbrains.annotations.**
-dontwarn com.google.errorprone.annotations.*
-dontwarn java.lang.invoke.*
-dontwarn org.codehaus.mojo.animal_sniffer.*

-keep class retrofit2.** { *; }
-keep class okio.** { *; }
-keep class okhttp3.** { *; }
-keep class io.reactivex.** { *; }
-keep class org.reactivestreams.** { *; }
-keep class kotlin.Metadata { *; }
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }
-keep interface org.parceler.Parcel
-keep public class * extends java.lang.Exception
-keep @com.squareup.moshi.JsonQualifier interface *
-keep interface kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader
-keep class kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoaderImpl
-keep class kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
}

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
-keepclasseswithmembers class * {
    @com.squareup.moshi.* <methods>;
}

-keepclassmembers class kotlin.Metadata {
    public <methods>;
}
-keepclassmembers class * {
    @com.squareup.moshi.FromJson <methods>;
    @com.squareup.moshi.ToJson <methods>;
}

# Enum field names are used by the integrated EnumJsonAdapter.
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
    <fields>;
}

-keepclassmembers class kotlin.Metadata {
    public <methods>;
}

# The name of @JsonClass types is used to look up the generated adapter.
-keepnames @com.squareup.moshi.JsonClass class *

# Moshi - Keep entity names
-keepnames @kotlin.Metadata class com.safeboda.data.entity.**
-keep class com.safeboda.data.entity.** { *; }
-keepclassmembers class com.safeboda.data.entity.** { *; }
-keepnames @kotlin.Metadata class com.safeboda.domain.entity.**
-keep class com.safeboda.domain.entity.** { *; }
-keepclassmembers class com.safeboda.domain.entity.** { *; }

# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

-keepclasseswithmembers class * {
    @com.squareup.moshi.* <methods>;
}

-keep @com.squareup.moshi.JsonQualifier interface *

# Enum field names are used by the integrated EnumJsonAdapter.
# values() is synthesized by the Kotlin compiler and is used by EnumJsonAdapter indirectly
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
    <fields>;
    **[] values();
}

# The name of @JsonClass types is used to look up the generated adapter.
-keepnames @com.squareup.moshi.JsonClass class *

# Retain generated target class's synthetic defaults constructor and keep DefaultConstructorMarker's
# name. We will look this up reflectively to invoke the type's constructor.
#
# We can't _just_ keep the defaults constructor because Proguard/R8's spec doesn't allow wildcard
# matching preceding parameters.
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-keepclassmembers @com.squareup.moshi.JsonClass @kotlin.Metadata class * {
    synthetic <init>(...);
}

# Retain generated JsonAdapters if annotated type is retained.
-if @com.squareup.moshi.JsonClass class *
-keep class <1>JsonAdapter {
    <init>(...);
    <fields>;
}
-if @com.squareup.moshi.JsonClass class **$*
-keep class <1>_<2>JsonAdapter {
    <init>(...);
    <fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*
-keep class <1>_<2>_<3>JsonAdapter {
    <init>(...);
    <fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*
-keep class <1>_<2>_<3>_<4>JsonAdapter {
    <init>(...);
    <fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*$*
-keep class <1>_<2>_<3>_<4>_<5>JsonAdapter {
    <init>(...);
    <fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*$*$*
-keep class <1>_<2>_<3>_<4>_<5>_<6>JsonAdapter {
    <init>(...);
    <fields>;
}

-keep class kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoaderImpl

-keepclassmembers class kotlin.Metadata {
    public <methods>;
}

Related issues:
square/moshi#1042
https://youtrack.jetbrains.com/issue/KT-29668

java.lang.VerifyError: Bad type on operand stack

This happens at runtime using ProGuard 6.2.2 on Java 11 and used to work under Proguard 5 and Java 8, if I remember correctly.

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    com/tagtraum/beatunes/songinfo/CoverPanel$CoverPanelTransferHandler.importData(Ljavax/swing/TransferHandler$TransferSupport;)Z @354: invokevirtual
  Reason:
    Type 'java/lang/Object' (current frame, stack[1]) is not assignable to 'java/lang/Exception'
  Current Frame:
    bci: @354
    flags: { }
    locals: { top, top, 'java/lang/Object' }
    stack: { 'org/slf4j/Logger', 'java/lang/Object' }
  Bytecode:
    0000000: 2bb6 0066 594d b200 3db9 006e 0200 9900
    0000010: 2dbb 0016 592c b200 3db9 006d 0200 c000
    0000020: 132a b400 41b6 0046 9900 09b2 003a a700
    0000030: 06b2 0039 b700 444e a700 3b2c b200 42b9
    0000040: 006e 0200 9900 2dbb 0016 592c b200 42b9
    0000050: 006d 0200 c000 1c2a b400 41b6 0046 9900
    0000060: 09b2 003a a700 06b2 0039 b700 454e a700
    0000070: 0501 4e2b b800 4a4c 2c2b b900 6d02 004d
    0000080: b200 3d2b b600 5299 0027 b200 3bb9 0078
    0000090: 0100 9900 11b2 003b 2dba 007b 0000 b900
    00000a0: 7502 002a b400 412d b600 47a7 00b0 b200
    00000b0: 432b b600 5299 0043 2cc0 0033 594c 03b9
    00000c0: 0071 0200 c000 234c b200 3bb9 0078 0100
    00000d0: 9900 11b2 003b 2bba 007c 0000 b900 7502
    00000e0: 002d c700 0b2a b400 412b b600 482a b400
    00000f0: 412b b600 48a7 0066 b200 3c2b b600 5199
    0000100: 0031 2cc0 002f 4cb2 003b b900 7801 0099
    0000110: 0011 b200 3b2b ba00 7d00 00b9 0075 0200
    0000120: 2bb8 0049 4c2a b400 412b b600 48a7 002e
    0000130: b200 422b b600 5199 0024 b200 3bb9 0078
    0000140: 0100 9900 11b2 003b 2dba 007e 0000 b900
    0000150: 7502 002a b400 412d b600 4704 ac4d b200
    0000160: 3b2c b600 5b2c b900 7703 0003 ac       
  Exception Handler Table:
    bci [0, 348] => handler: 349
    bci [0, 348] => handler: 349
  Stackmap Table:
    full_frame(@49,{Object[#25],Object[#55],Object[#33]},{Uninitialized[#17],Uninitialized[#17],Object[#19]})
    full_frame(@52,{Object[#25],Object[#55],Object[#33]},{Uninitialized[#17],Uninitialized[#17],Object[#19],Object[#20]})
    same_frame(@59)
    full_frame(@103,{Object[#25],Object[#55],Object[#33]},{Uninitialized[#71],Uninitialized[#71],Object[#28]})
    full_frame(@106,{Object[#25],Object[#55],Object[#33]},{Uninitialized[#71],Uninitialized[#71],Object[#28],Object[#20]})
    same_frame(@113)
    append_frame(@115,Object[#22])
    full_frame(@163,{Object[#25],Top,Top,Object[#22]},{})
    full_frame(@174,{Object[#25],Object[#31],Object[#41],Object[#22]},{})
    full_frame(@225,{Object[#25],Object[#35],Top,Object[#22]},{})
    chop_frame(@237,2)
    full_frame(@248,{Object[#25],Object[#31],Object[#41],Object[#22]},{})
    full_frame(@288,{Object[#25],Object[#47]},{})
    full_frame(@304,{Object[#25],Object[#31],Top,Object[#22]},{})
    full_frame(@339,{Object[#25],Top,Top,Object[#22]},{})
    full_frame(@347,{},{})
    same_locals_1_stack_item_frame(@349,Object[#41])

Relevant sources (notice the collapsed Exception block at the end):

        public boolean importData(final TransferSupport support) {
            try {
                final Transferable transferable = support.getTransferable();
                final AudioArtwork artwork;
                if (transferable.isDataFlavorSupported(ARTWORK_DATA_FLAVOR)) {
                    artwork = new StandardAudioArtwork((AudioArtwork)transferable.getTransferData(ARTWORK_DATA_FLAVOR), isFront() ? AudioArtwork.Kind.COVER_FRONT : AudioArtwork.Kind.COVER_BACK);
                } else if (transferable.isDataFlavorSupported(DataFlavor.imageFlavor)) {
                    artwork = new StandardAudioArtwork((Image)transferable.getTransferData(DataFlavor.imageFlavor), isFront() ? AudioArtwork.Kind.COVER_FRONT : AudioArtwork.Kind.COVER_BACK);
                } else {
                    artwork = null;
                }
                final DataFlavor dataFlavor = selectBestImageDataFlavor(support);
                final Object transferData = transferable.getTransferData(dataFlavor);
                final File file;
                if (ARTWORK_DATA_FLAVOR.match(dataFlavor)) {
                    if (LOG.isDebugEnabled()) LOG.debug("Dropping artwork: " + artwork);
                    setArtwork(artwork);
                } else if (DataFlavor.javaFileListFlavor.match(dataFlavor)) {
                    final List<File> files = (List<File>) transferData;
                    file = files.get(0);
                    if (LOG.isDebugEnabled()) LOG.debug("Dropping file: " + file);
                    if (artwork == null) setArtwork(file);
                    setArtwork(file);
                } else if (URL_DATA_FLAVOR.equals(dataFlavor)) {
                    final URL url = (URL)transferData;
                    if (LOG.isDebugEnabled()) LOG.debug("Dropping URL: " + url);
                    file = toFile(url);
                    setArtwork(file);
                } else if (DataFlavor.imageFlavor.equals(dataFlavor)) {
                    if (LOG.isDebugEnabled()) LOG.debug("Dropping image: " + artwork);
                    setArtwork(artwork);
                }
                return true;
            } catch (UnsupportedFlavorException | IOException e) {
                LOG.error(e.toString(), e);
            }
            return false;
        }

Perhaps related to https://sourceforge.net/p/proguard/bugs/607/

ProGuard Configuration:

-ignorewarnings

-libraryjars ${libraryjars.jars.only}
-injars ${project.build.directory}/classes
-outjars ${project.build.directory}/obfuscated-classes
-printmapping ${project.build.directory}/proguard.map
-renamesourcefileattribute SourceFile
-keepattributes InnerClasses,SourceFile,LineNumberTable,Deprecated,Signature,*Annotation*,EnclosingMethod,Exceptions
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses

-keepnames class *

-keep public class * {
public *;
protected *;
}

-keep public class com.tagtraum.beatunes.library.* {
    private &lt;fields&gt;;
}
-keep public class com.tagtraum.beatunes.analysis.* {
    private &lt;fields&gt;;
}
-keep public class com.tagtraum.beatunes.library.MatchListInfo {
    private &lt;fields&gt;;
}

-keepclassmembernames class * {
java.lang.Class class$(java.lang.String);
java.lang.Class class$(java.lang.String, boolean);
}

-keepclasseswithmembernames class * {
native &lt;methods&gt;;
}

-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}

-keepclassmembers class * extends java.lang.Enum {
public **[] values();
}

-keep class com.tagtraum.beatunes.** {
void set*(%);
void set*(**);
void set*(%[]);
void set*(**[]);
void set*(int, %);
void set*(int, **);

% get*();
** get*();
%[] get*();
**[] get*();
% get*(int);
** get*(int);

% is*();
** is*();
%[] is*();
**[] is*();
% is*(int);
** is*(int);
}

With

libraryjars = /Library/Java/JavaVirtualMachines/liberica-jdk-11.0.4/Contents/Home/jmods/java.base.jmod(!**.jar;!module-info.class):/Library/Java/JavaVirtualMachines/liberica-jdk-11.0.4/Contents/Home/jmods/java.desktop.jmod(!**.jar;!module-info.class):<lots and lots of jars...>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.