-
-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting proguard
via Options and/or external resources
#1236
Comments
every Java app would benefit from it, so removing the specific labels |
a dumb example would be:
|
I also came across this issue and would really like to help. If you could give me some advice on how I should/could implement the solution into sentry-java or sentry-spring, I would be happy to do so. Temporary Spring Boot Solution: package XX;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import io.sentry.SentryEvent;
import io.sentry.SentryOptions.BeforeSendCallback;
import io.sentry.protocol.DebugImage;
import io.sentry.protocol.DebugMeta;
@Component
public class SentryProguardBeforeSendCallback implements BeforeSendCallback {
private final String[] proguardUuids;
public SentryProguardBeforeSendCallback(@Value("${sentry.proguardUuids}") String[] proguardUuids) {
this.proguardUuids = proguardUuids;
}
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
if (event.getDebugMeta() == null) {
event.setDebugMeta(new DebugMeta());
}
if (event.getDebugMeta().getImages() == null) {
event.getDebugMeta().setImages(new ArrayList<DebugImage>());
}
final var debugImages = Arrays
.stream(proguardUuids)
.map((uuid) -> {
final var image = new DebugImage();
image.setType("proguard");
image.setUuid(uuid);
return image;
})
.collect(Collectors.toList());
event.getDebugMeta().getImages().addAll(debugImages);
return event;
}
} |
A Java App (non Android-probably Desktop) may be obfuscated using the Proguard tooling and right now there's no easy way to set up the
proguard
id if not using thebeforeSend
callback.Ideally, this would be possible via SentryOptions or external resources.
See on Android:
sentry-java/sentry-android-core/src/main/java/io/sentry/android/core/DefaultAndroidEventProcessor.java
Lines 239 to 244 in f6bca67
on Android the Sentry Gradle plugin uploads the mapping file via sentry-cli and injects its
id
in the assets folder of the App which is packaged in the final APK.At runtime, the SDK reads this file and sets the
id
to the debug images.The text was updated successfully, but these errors were encountered: