Fix "NoClassDefFoundError: Failed resolution of: Lorg/apache/logging/log4j/LogManager #326 (#328)

* Remove log4j from injected classes

* Add release note
This commit is contained in:
James Hamilton
2023-03-30 13:00:41 +02:00
committed by GitHub
parent 1f8f548d36
commit 4cff876e44
3 changed files with 15 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
* Copyright (c) 2002-2021 Guardsquare NV
* Copyright (c) 2002-2023 Guardsquare NV
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,9 +21,6 @@
package proguard.configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
@@ -44,8 +41,6 @@ import java.util.Set;
*/
public class ConfigurationLogger implements Runnable
{
private static final Logger logger = LogManager.getLogger(ConfigurationLogger.class);
// Logging constants.
private static final boolean LOG_ONCE = false;
private static final String ANDROID_UTIL_LOG = "android.util.Log";
@@ -1135,12 +1130,12 @@ public class ConfigurationLogger implements Runnable
}
catch (Exception e)
{
logger.error(message);
System.err.println(message);
}
}
else
{
logger.error(message);
System.err.println(message);
}
}

View File

@@ -20,13 +20,13 @@
*/
package proguard.optimize.gson;
import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.bind.ReflectiveTypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.*;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.Map;
/**
@@ -42,8 +42,6 @@ import java.util.Map;
*/
public final class _GsonUtil
{
private static final Logger logger = LogManager.getLogger(_GsonUtil.class);
/**
* Returns the appropriate type adapter for handling the given value with
* the given declared type.
@@ -138,10 +136,10 @@ public final class _GsonUtil
*/
public static void dumpTypeTokenCache(String message, Map<TypeToken<?>, TypeAdapter<?>> typeTokenCache)
{
logger.info(message);
System.out.println(message);
for (Map.Entry<TypeToken<?>, TypeAdapter<?>> typeTokenCacheEntry : typeTokenCache.entrySet())
{
logger.info(" {} -> {}", typeTokenCacheEntry.getKey(), typeTokenCacheEntry.getValue());
System.out.println(" " + typeTokenCacheEntry.getKey() + " -> " + typeTokenCacheEntry.getValue());
}
}
}

View File

@@ -1,3 +1,9 @@
## Version 7.3.3
### Bugfixes
- Fix "NoClassDefFoundError: Failed resolution of: Lorg/apache/logging/log4j/LogManager" when using GSON optimization or `-addconfigurationdebugging`. (#326)
## Version 7.3.2
### Java support