Giter VIP home page Giter VIP logo

raygun4android's People

Stargazers

 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

raygun4android's Issues

Basic Gradle setup not working

Hi,

Following up from a support ticket, I cannot get Raygun to build in any gradle and Android Studio based project. Perhaps someone out there can help.

/Users/paul/sc/android-raygun-integration-test/app/src/main/java/rgtest1/android/showcase/myapplication/FullscreenActivity.java:13: error: package main.java.com.mindscapehq.android.raygun4android does not exist
import main.java.com.mindscapehq.android.raygun4android.RaygunClient;
                                                       ^
/Users/paul/sc/android-raygun-integration-test/app/src/main/java/rgtest1/android/showcase/myapplication/FullscreenActivity.java:14: error: package main.java.com.mindscapehq.android.raygun4android.messages does not exist
import main.java.com.mindscapehq.android.raygun4android.messages.RaygunUserInfo;
                                                                ^
/Users/paul/sc/android-raygun-integration-test/app/src/main/java/rgtest1/android/showcase/myapplication/FullscreenActivity.java:60: error: cannot find symbol
        RaygunClient.Init(getApplicationContext());
        ^
  symbol:   variable RaygunClient
  location: class FullscreenActivity
/Users/paul/sc/android-raygun-integration-test/app/src/main/java/rgtest1/android/showcase/myapplication/FullscreenActivity.java:61: error: cannot find symbol
        RaygunClient.AttachExceptionHandler();
        ^
  symbol:   variable RaygunClient
  location: class FullscreenActivity
4 errors
:app:compileDebugJava FAILED

FAILURE: Build failed with an exception.

I've made a repo with full source to demonstrate that the setup is as per documentation:
https://github.com/ShowcaseSoftwareLtd/android-raygun-integration-test

Manually setting version on RaygunClient can break mapping.

If I do not set the version on the Raygun client and upload a mapping file matching the version eg '1.5.2.txt' the stack trace is de-obfuscated as expected.

However if I set the version manually to provide more information, name & version code eg:

RaygunClient.setVersion("${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")

The crash report will show the version as I set manually eg: 1.5.2 (452)
But uploading a file '1.5.2 (452).txt' does not de-obfuscate any future crash reports.

This did work as expected in a previous version.

I have changed how I name the version to the following:

RaygunClient.setVersion("${BuildConfig.VERSION_NAME}_${BuildConfig.VERSION_CODE}")

eg 1.5.2_452 and this does work uploading a file '1.5.2_452.txt'.

This solves it for me, but adding this incase anyone else has the same issue, I'm not sure if this file name should not contain spaces?

App has stopped dialog shown on Android devices when calling Raygun.send()

Hi,
I'm doing maintenance on an app (which has been using Raygun successfully for a year now), and every time I do a Raygun.send I get a dialog pop up with "Unfortunately, {app-name] has stopped". Its a modal dialog which clears when I click OK, but the app is never stopped i.e. it hasn't crashed, and continues to work fine.

It happens with both debug and release builds, and nothing reaches my Raygun console. I've also tried 2 different api keys, both show the issue. I've also tried an api key from another app (which works within the other app). The Android logcat screen doesn't show any errors, just the I/System.out: message detailing the attempt to send the message.

Raygun version is 3.0.2 (also tried 3.0.0) and compileSDKVersion is 27 (both of these are used in another app which works ok).

I've also reviewed all method calls on RaygunClient - I make one call to init and attachExceptionHandler in my Application class, and the rest are all send calls.

Is there a quick easy explanation for this?

Compile requires android 24+?

I attempted to update my app from 3.0.6 to 4.0.1 today and I got the following build error:
Caused by: com.android.tools.r8.utils.AbortException: Error: Static interface methods are only supported starting with Android N (--min-api 24): void com.raygun.raygun4android.logging.TimberRaygunLogger.init()

The documentation says raygun is compatible with 16+ but this error indicates it requires 24+. Am I doing something wrong or was the compatibility changed?

Another NPE in RaygunPostService

Message: NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isConnectedOrConnecting()' on a null object reference

main.java.com.mindscapehq.android.raygun4android.RaygunPostService.hasInternetConnection in RaygunPostService.java::92
main.java.com.mindscapehq.android.raygun4android.RaygunPostService.access$000 in RaygunPostService.java::18
main.java.com.mindscapehq.android.raygun4android.RaygunPostService$1.run in RaygunPostService.java::37
java.lang.Thread.run in Thread.java::764

This still happens occasionally in 3.0.4.

It comes from a very edge-case timing issue in the ConnectivityManager when the network is in the process of coming down.

I'll have a proper fix for it now - ran into a similar issue in a client project, will ping through a PR in the next couple of days.

StackOverflow exceptions/crashes not reported by Raygun

Hi,

We have noticed that Raygun doesn't seem to pick up any crashes caused by StackOverflow errors. For example, we have the following stack trace in our Play Console:

java.lang.StackOverflowError: 
  at androidx.core.view.ViewCompat.getLayoutDirection (ViewCompat.java:1558)
  at androidx.drawerlayout.widget.DrawerLayout.findDrawerWithGravity (DrawerLayout.java:986)
  at androidx.drawerlayout.widget.DrawerLayout.isDrawerOpen (DrawerLayout.java:1836)
  at com.mikepenz.materialdrawer.Drawer.isDrawerOpen (Drawer.java:153)
  at xxx.yyy.zzz.MainActivity.onBackPressed (MainActivity.kt:292)
  at xxx.yyy.zzz.FragmentNavigatorImpl.navigateBack (FragmentNavigatorImpl.kt:72)
  at xxx.yyy.zzz.MainActivity.navigateBack (MainActivity.kt:344)
  at xxx.yyy.zzz.MainActivity.onBackPressed (MainActivity.kt:310)
  at xxx.yyy.zzz.FragmentNavigatorImpl.navigateBack (FragmentNavigatorImpl.kt:72)
  at xxx.yyy.zzz.MainActivity.navigateBack (MainActivity.kt:344)
  at xxx.yyy.zzz.MainActivity.onBackPressed (MainActivity.kt:310)

However, these stack traces are not reported in Raygun. I can confirm we have set up/initialised the RaygunClient correctly using the following code in our Activity's onCreate() method:

RaygunClient.init(application)
RaygunClient.setVersion(BuildConfig.VERSION_NAME)
RaygunClient.enableCrashReporting()
RaygunPageTags.init(deviceType)
RaygunClient.enableRUM(this)

Is there anything that could be preventing Raygun from reporting these StackOverflow crashes?

Version ussed: 4.0.1

Thank you for your support.

RaygunClient.send causes NullPointerException, null pointer exception is not handled properly causing another null pointer exception

Calling RaygunClient.send causes NullPointerException

The following appears in the logcat

2018-10-08 11:18:52.845 10560-10560/? W/Raygun4Android: Couldn't get all env data: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
2018-10-08 11:18:52.847 10560-10560/? E/Raygun4Android: Failed to build RaygunMessage - java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
2018-10-08 11:18:52.847 10560-10560/? E/TLog: Raygun failed to send error, trying again with limited data. Error: java.lang.NullPointerException: Attempt to invoke virtual method 'main.java.com.mindscapehq.android.raygun4android.messages.RaygunMessageDetails main.java.com.mindscapehq.android.raygun4android.messages.RaygunMessage.getDetails()' on a null object reference

Looks like there are three problems here!

First problem

2018-10-08 11:18:52.845 10560-10560/? W/Raygun4Android: Couldn't get all env data: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

  public RaygunEnvironmentMessage(Context context) {
    try {
      architecture = Build.CPU_ABI;
      oSVersion = Build.VERSION.RELEASE;
      osSDKVersion = Build.VERSION.SDK;
      deviceName = Build.MODEL;
      deviceCode = Build.DEVICE;
      brand = Build.BRAND;
      board = Build.BOARD;

      processorCount = Runtime.getRuntime().availableProcessors();

      int orientation = context.getResources().getConfiguration().orientation; // ----> context is null here!


      .setEnvironmentDetails(RaygunClient.context)

I don't know how the context could possibly be null, although I am investigating this issue now. This could be a problem with my code base. Will provide updates later when i find more information

Second problem

2018-10-08 11:18:52.847 10560-10560/? E/Raygun4Android: Failed to build RaygunMessage - java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference

Another null context problem, could be related to the above problem, am investigating this issue now

Third problem

    2018-10-08 11:18:52.847 10560-10560/? E/TLog: Raygun failed to send error, trying again with limited data. Error: java.lang.NullPointerException: Attempt to invoke virtual method 'main.java.com.mindscapehq.android.raygun4android.messages.RaygunMessageDetails main.java.com.mindscapehq.android.raygun4android.messages.RaygunMessage.getDetails()' on a null object reference

  public static void send(Throwable throwable, List tags, Map userCustomData) {
    RaygunMessage msg = buildMessage(throwable);

    msg.getDetails().setTags(mergeTags(tags));          // -----> See below comment. Of course we are getting a null pointer exception here!
    msg.getDetails().setUserCustomData(mergeUserCustomData(userCustomData));

    if (RaygunClient.onBeforeSend != null) {
      msg = RaygunClient.onBeforeSend.onBeforeSend(msg);
      if (msg == null) {
        return;
      }
    }

    postCachedMessages();
    spinUpService(RaygunClient.apiKey, new Gson().toJson(msg), false);
  }


  private static RaygunMessage buildMessage(Throwable throwable) {
    try {
      RaygunMessage msg =  RaygunMessageBuilder.instance()
          .setEnvironmentDetails(RaygunClient.context)
          .setMachineName(Build.MODEL)
          .setExceptionDetails(throwable)
          .setClientDetails()
          .setAppContext(RaygunClient.appContextIdentifier)
          .setVersion(RaygunClient.version)
          .setNetworkInfo(RaygunClient.context)
          .build();

      if (RaygunClient.version != null) {
        msg.getDetails().setVersion(RaygunClient.version);
      }

      if (RaygunClient.userInfo != null) {
        msg.getDetails().setUserContext(RaygunClient.userInfo, RaygunClient.context);
      }
      else if (RaygunClient.user != null) {
        msg.getDetails().setUserContext(RaygunClient.user);
      }
      else {
        msg.getDetails().setUserContext(RaygunClient.context);
      }
      return msg;
    }
    catch (Exception e) {
      RaygunLogger.e("Failed to build RaygunMessage - " + e);
    }
    return null; // -------------------------> Somebody wasn't thinking straight :P. The catch above shouldn't even be there!
  }

This issue Could be related to #44

Gradle 8 support

The builds are now using Gradle 7.x, which is current as of AS Giraffe 2022.3.1+.

There is Gradle 8 already on the horizon and it's known to cause a variety of issues when upgrading regarding required changes to build flows.

This should be upgraded as soon as possible.

Raygun Client using Activity reference for attaching pulse

RaygunClient.attachPulse(this); // taking an activity reference

Could'nt it use an applicationContext?

Since we attach it on SplashActivity meant it kept splashActivity alive throughout application lifecycle

using implementation 'com.mindscapehq.android:raygun4android:3.0.3' on build.gradle

Allow SSLContext to be provided

Raygun uses OkHttpClient to make it's posts.

Use Case:

  • We have overridden the endpoint to a different endpoint
  • The certificates involved are not be trusted by the phones default CA's (internal network)

Problem:
The default SSLContext will fail to handshake and the requests will fail.

Solution:
Allow a SSLContext to be supplied to RaygunSettings that will be set on the OKHttpClient:

    new OkHttpClient.Builder()
     .sslSocketFactory(sslContext.getSocketFactory())

This would be needed in both post services
https://github.com/MindscapeHQ/raygun4android/blob/master/provider/src/main/java/com/raygun/raygun4android/services/CrashReportingPostService.java#L114
https://github.com/MindscapeHQ/raygun4android/blob/master/provider/src/main/java/com/raygun/raygun4android/services/RUMPostService.java#L69

Cannot build

Hello,
after following your instructions for Gradle dependencies, I get this compilation error:

Dependency com.mindscapehq.android:raygun4android:1.2.0 on project Application resolves to an APK archive which is not supported as a compilation dependency. File: C:\Users\Igor.gradle\caches\modules-2\files-2.1\com.mindscapehq.android\raygun4android\1.2.0\762ffb14c64e8dffedf6ac6f0431d83755caefc3\raygun4android-1.2.0.apk

Please advise,
Igor

Do we need the empty resource file in provider?

That's an interesting question because the file gets created by default when you setup a project and has app_name in there, in case you want to use it - I guess. We didn't use the resource in the provider, so I emptied it. I'd be cautious with removing it - but I'll give that a try in the next piece of work. Right now it doesn't really bother me being there.

Originally posted by @TheRealAgentK in #88 (comment)

Attached UncaughtExceptionHandler still catches caught exceptions

Code:

try {
    return new Gson().fromJson(jsonStr, X.class);
}
catch (Exception ex) {
    return new X();
}

new Gson().fromJson() throws JsonSyntaxException which is still caught by app-wide 'UncaughtExceptionHandler' instantiated via RaygunClient.AttachExceptionHandler() - even though exception is being caught.

Could this be due to being called from within an IntentService (so background)..?

R8 map center support

The Raygun dashboard for my app does not have an option to upload an R8 mapping file. Will Raygun support this in the near future like it currently does for Proguard?

Version 1.0 Tasks

  • Complete message building - json packet accepted by api
  • Use Log.e everywhere
  • Fix rg4and pom to copy .jar to local repo
  • API config in AndroidManifest.xml
  • Maven deploy stuff
  • Add sample project to repo
  • Batch sending for no network - and other common functionality
  • Tests
  • Docs

Disk Space Environment Data overflows int reporting garbage negative numbers

Sample App: Package naming double-up

The package naming in the :app module has sample somewhat doubled-up.

package com.raygun.raygun4androidsample.sample

Refactor into a simpler path.

Update to support libs, remove need for Jetifier

this repo has not been updated for a bout an year. I was trying to disable Jetifier on my project and this is the only project left.
so how are you guys doing? actually I could update this project myself and send pr, will you guys accept it?

RUM support for Fragments

Is there proper support for fragments in RUM?
What is the solution for apps that use a single activity?

I'm currently using public static void sendRUMTimingEvent(RaygunRUMEventType eventType, String name, long milliseconds) but there doesn't seem to be a way to track viewing time.

In the RUM web console, I am able to see the different fragments loaded (by sending a RUMTimingEvent with ACTIVITY_LOADED event type), but viewing time is not correct. As far as I can tell the 'Viewing Time' is calculated as the duration between the current RUM Timing Event and the next Timing Event. Since network requests are also tracked as RUM Timing Events, Fragments that make a network requests report false viewing times (i.e. time from Fragment load to next network event, not the time until next Fragment event).

Screen Shot 2020-02-27 at 1 09 46 PM

Run `CrashReportingPostService` in main process

Hi team,

<service android:name="com.raygun.raygun4android.services.CrashReportingPostService"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE"
            android:process=":crashreportingpostservice"/>

Is it safe if I remove android:process=":crashreportingpostservice so CrashReportingPostService will run only in main process? My intention is, I want to make sure my Application only run in one process, Pls advise.

Thanks.

NullPointerException when RaygunClient.recordBreadcrumb() is called

2019-06-28 14:41:08.927 11019-11019/? W/System.err: java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference
2019-06-28 14:41:08.927 11019-11019/? W/System.err: at com.raygun.raygun4android.CrashReporting.recordBreadcrumb(CrashReporting.java:65)
2019-06-28 14:41:08.927 11019-11019/? W/System.err: at com.raygun.raygun4android.CrashReporting.recordBreadcrumb(CrashReporting.java:61)
2019-06-28 14:41:08.927 11019-11019/? W/System.err: at com.raygun.raygun4android.RaygunClient.recordBreadcrumb(RaygunClient.java:216)

Including raygun forces apps to use Timber or suffer a million lint warnings.

Timber appears to have several embedded lint rules, of which one is particularly annoying. The LogNotTimber lint rule which gets inherited by anybody including Raygun, causes all uses of Log to have a lint warning that it should be using Timber.
This cannot be easily worked around, as Android Studio Code inspection profiles are per computer and not something that can be commited into a shared code repository.

I don't think we should have to use Timber in order to use raygun.

Raygun RUM process causes RuntimeException

I added Raygun for my app, following the instructions provided by the official documentation.
After roll out to production, I'm receiving numerous crashes in Firebase Crashlytics, caused by the RUM process of Raygun added in the AndroidManifest.

The Stacktrace of the exception is:

Fatal Exception: java.lang.RuntimeException
Using WebView from more than one process at once with the same data directory is not supported. https://crbug.com/558377 : 
Current process com.example.package:rumpostservice (pid 1479), lock owner com.example.package (pid 30096)

Obviously, "com.example.package" is not the real package name of the app.

Can anyone help me with this issue?

NPE in RaygunPostService

I've recently seen this popping up a bit in the ANR & crashes section in Play Console:

java.lang.NullPointerException
main.java.com.mindscapehq.android.raygun4android.RaygunPostService.hasInternetConnection

Samsung Galaxy S7 Edge (hero2lte), 4096MB RAM, Android 7.0
Report 5

java.lang.NullPointerException:
at main.java.com.mindscapehq.android.raygun4android.RaygunPostService.hasInternetConnection (RaygunPostService.java:93)
at main.java.com.mindscapehq.android.raygun4android.RaygunPostService.access$000 (RaygunPostService.java:18)
at main.java.com.mindscapehq.android.raygun4android.RaygunPostService$1.run (RaygunPostService.java:41)
at java.lang.Thread.run (Thread.java:762)

Looking at the code, it seems that cm might be null.

Refactor UserCustomData to CustomData

I feel that we should start removing "User" when referencing custom data. Every discussion we have at Raygun we never say UserCustomData, it's always CustomData. I think we should remove it for the 4.0.0 release. I am planning on redoing the API spec for providers this year and thats one thing I want to change. The json payload will still need send it as "userCustomData" but the API can have it removed.

Originally posted by @mduncan26 in #56

Provider has version 3.0.0 hardcoded

RaygunClientMessage line 10:

setVersion("3.0.0");

Expected: Always gets set to the current version of the provider. Ideally should be pulled from pom/manifest at runtime.

Write docs

  • readme.md
  • Update Not set up dashboard in website

IP Address when in Wifi behind NAT

It seems that quite often with devices in Wifi, the provider only logs an internal/NAT IP address.

That's not ideal for cross referencing data with other services and monitoring.

Tested with RG4A 3.0.x

a) Check if that's still the case with 4.x
b) If yes, look into a better solution and viability of other means to collect an external IP

Bump OKHttp to 4.x

Bump OKHttp should be bumped to 4.x if we can. Needs a closer look because v4 has a bunch of API changes that could hit the :provider module.

Crash events not cached when no internet connectivity

Using an Android device connected via ethernet to a ECU/Gateway.

If the Android device has a connection to a host, it can still fail to send, and the message will not be cached.

RaygunPostService.java, Line 43

        if (isPulse && hasInternet) {
          RaygunClient.postPulseMessage(apiKey, message);
        } else if (!isPulse && hasInternet) {
          RaygunClient.post(apiKey, message); // This can fail and does not end up cached
        } else if (!isPulse && !hasInternet) {
           // Caches to filesystem

currently using a work around, but may be other effects from this use case

        boolean store = !hasInternet && !isPulse;
        if (isPulse && hasInternet) {
          RaygunClient.postPulseMessage(apiKey, message);
        } else if (!isPulse && hasInternet) {
          if (RaygunClient.post(apiKey, message) == -1) store = true;
        } 
        if (store) {
            // Caches to filesystem

Android 6.0 Support

Android 6.0 ( M ) does not support Apache Http Library anymore.
The documentation suggests to use HttpUrlConnection implementation instead.
You can still use Apache library by changing build file to use legacy Apache library, but it's just a temporary resolution.
Since Raygun is not supporting Android 2.2 or under, remove dependency on Apache Http library can be done without any dependency problems.

Check out the following link.

http://developer.android.com/preview/behavior-changes.html#behavior-apache-http-client

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.