Skip to content

Commit

Permalink
fix: fix no class found error for harecordHandledException method
Browse files Browse the repository at this point in the history
fix #129
  • Loading branch information
ndesai-newrelic committed Sep 15, 2023
1 parent a195907 commit 89129cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 2 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ if (findProject(':@newrelic-react-native-agent')) {

android {
namespace "com.NewRelic"
compileSdkVersion 31

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName version
}
Expand All @@ -76,7 +75,7 @@ repositories {
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
compileOnly 'com.facebook.react:react-native:+'
implementation "com.newrelic.agent.android:android-agent:${ReactNative.ext.getVersion("newrelic", "android")}"
implementation "com.newrelic.agent.android:agent-ndk:${ReactNative.ext.getVersion("newrelic", "ndk")}"
Expand Down
18 changes: 16 additions & 2 deletions android/src/main/java/com/NewRelic/NRMModularAgentModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,22 @@ private StackTraceElement[] generateStackTraceElements(Map<String, Object> stack
List<StackTraceElement> stackTraceList = new ArrayList<>();
for(int i = 0; i < stackFrameMap.size(); ++i) {
Map<String, Object> element = (Map<String, Object>) stackFrameMap.get(Integer.toString(i));
String methodName = (String) element.getOrDefault("methodName", "");
String fileName = (String) element.getOrDefault("file", "");
String methodName = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
methodName = (String) element.getOrDefault("methodName", "");
} else {
if (element.containsKey("methodName")) {
methodName = (String)element.get("methodName");
}
}
String fileName = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
fileName = (String) element.getOrDefault("file", "");
} else {
if (element.containsKey("file")) {
fileName = (String)element.get("file");
}
}
int lineNumber = element.get("lineNumber") != null ? ((Double) element.get("lineNumber")).intValue() : 1;
StackTraceElement stackTraceElement = new StackTraceElement(" ", methodName, fileName, lineNumber);
stackTraceList.add(stackTraceElement);
Expand Down

0 comments on commit 89129cd

Please sign in to comment.