rollbar-java icon indicating copy to clipboard operation
rollbar-java copied to clipboard

Android data is sent but doesn't appear on Rollbar

Open dieg0 opened this issue 6 years ago • 16 comments

Hi, we have a Kotlin Android app, we want to integrate rollbar but so far it hasn't worked, our gradle fie:

android {
    compileSdkVersion 26
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.basecamp:turbolinks:1.0.8'
    implementation 'com.rollbar:rollbar-java:1.4.0'
}

Lines from Main Activity:

import com.rollbar.notifier.Rollbar
import com.rollbar.notifier.config.ConfigBuilder

class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
    lateinit private var turbolinksHelper: TurbolinksHelper

    val config = ConfigBuilder.withAccessToken("f9178dca7b5d450b986b36ddc8b2159a")
        .language("scala")
        .codeVersion("1.0.0")
        .environment("production")
        .enabled(true)
        .build()
    val rollbar = Rollbar.init(config)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        rollbar.info("This is a test message")
        rollbar.log(Error("this is an error"), "another thing to exist")

Using Charles I can see that the app is communicating with rollbar service, but nothing appears on the projects dashboard

Thanks in advance

dieg0 avatar Jan 09 '19 19:01 dieg0

Hi @dieg0,

Can you share the logs from Charles? I'd like to see what HTTP response code is returned from the Rollbar API when your app makes a call to it.

jessewgibbs avatar Jan 10 '19 16:01 jessewgibbs

@dieg0 I haven't heard back so I'm going to close this issue until I receive more information from you.

jessewgibbs avatar Jan 14 '19 17:01 jessewgibbs

image

image

image

image

Hi @jessewgibbs . This is my Charles log.

shaka0241 avatar Jan 14 '19 19:01 shaka0241

Can you export the full text content?

jessewgibbs avatar Jan 14 '19 19:01 jessewgibbs

image

image

image

MY XML FILE

shaka0241 avatar Jan 14 '19 20:01 shaka0241

image

@jessewgibbs

shaka0241 avatar Jan 14 '19 20:01 shaka0241

Hey there,

I think this is an issue with your local configuration. Check out https://stackoverflow.com/questions/49117151/charles-proxy-ssl-ssl-proxying-not-enabled-for-this-host. Can you try making that update in your local configuration and then see if it works?

jessewgibbs avatar Jan 17 '19 17:01 jessewgibbs

We configure charles correctly. Apparently the rollbar call is not being made. According to the documentation, it has been configured as follows:

Lines from Main Activity

package myname

import android.os.Bundle
import android.support.design.widget.NavigationView
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.MenuItem
import com.a50devs.hnry_turbo.utils.Constants
import com.rollbar.notifier.Rollbar
import com.rollbar.notifier.config.ConfigBuilder
import kotlinx.android.synthetic.main.content_main.*

class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
    lateinit private var turbolinksHelper: TurbolinksHelper

    val config = ConfigBuilder.withAccessToken("mytoken")
        .language("scala")
        .codeVersion("1.0.0")
        .environment("production")
        .enabled(true)
        .build()
    val rollbar = Rollbar.init(config)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.d("prueba consola","hola de nuevo")
        Log.d("prueba consola",rollbar.toString())
        rollbar.info("This is a test message")
        rollbar.log(Error("this is an error"), "another thing to exist")
        setContentView(R.layout.activity_main)
        turbolinksHelper = TurbolinksHelper(this, this, turbolinksView)
        turbolinksHelper.visit(getString(R.string.base_url), true)
    }

    override fun onRestart() {
        super.onRestart()
        rollbar.info("This is a test message")
        turbolinksHelper.visit(getString(R.string.base_url), true)
    }

    override fun onNavigationItemSelected(item: MenuItem): Boolean {
        return false
    }
}

"rollbar.info("This is a test message")" AND "rollbar.log(Error("this is an error"), "another thing to exist")" isnt work..

shaka0241 avatar Jan 18 '19 14:01 shaka0241

Thanks @shaka0241

Yes, once we configured charles correctly we didn't see the call to rollbar anymore, we don't know why. Our software calls a turbolinks staging site on https, we are now seeing that request correctly, but rollbar doesn't show up on charles.

Log.d(rollbar.toString()) returns the object com.rollbar.notifier.Rollbar@dddcc5e

rollbar.info("This is a test message") this returns void or in this case kotlin.Unit Can we look into a response from the info post?

dieg0 avatar Jan 18 '19 14:01 dieg0

Hi @shaka0241 ,

I think that maybe the problem is that the async sender is not sending the payloads of the buffer. Could you please try to add a call to the rollbar's close method?

Maybe a good place to add it would in the onStop method. Or just as a quick test in the onCreate after the calls to info and log just to verify that it works. The code would be:

rollbar.close(true);

Thanks!

basoko avatar Jan 18 '19 14:01 basoko

I tried, but it does not keep showing me the call to rollbar.


   override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.d("prueba consola","hola de nuevo")
        Log.d("prueba consola",rollbar.toString())
        rollbar.info("This is a test message")
        rollbar.log(Error("this is an error"), "another thing to exist")
        setContentView(R.layout.activity_main)
        turbolinksHelper = TurbolinksHelper(this, this, turbolinksView)
        turbolinksHelper.visit(getString(R.string.base_url), true)
        rollbar.close(true);

    }

@basoko 

shaka0241 avatar Jan 18 '19 14:01 shaka0241

@rokob any ideas about how to troubleshoot this further?

jessewgibbs avatar Jan 18 '19 16:01 jessewgibbs

Please anyone has any idea how we can get this to work? We have instantiated rollbar and tried init, log, info and close methods from that object. Perhaps this isn't the right approach in Kotlin? Thanks in advance.

@jessewgibbs @basoko @rokob

shaka0241 avatar Jan 22 '19 15:01 shaka0241

Sorry for the lack of reply. I am going to make an app in Kotlin and see if I can dig into what is going on here. Everything you are doing appears correct, so I will see what I can find out playing with it myself.

rokob avatar Mar 14 '19 18:03 rokob

Sorry for the lack of reply. I am going to make an app in Kotlin and see if I can dig into what is going on here. Everything you are doing appears correct, so I will see what I can find out playing with it myself.

Thanks a lot!

shaka0241 avatar Mar 14 '19 20:03 shaka0241

Hi @rokob, has there been any progress here? I am having the same issue on a Kotlin Android app, I don't see any Rollbar activity in the network profiler.

jtrinc avatar Dec 09 '21 22:12 jtrinc

@dieg0 are you still unable to integrate rollbar? We believe this works as expected and would like to confirm before closing this issue.

alif avatar Jun 03 '24 22:06 alif

No longer working on that project, no problem if you close the issue

dieg0 avatar Jun 03 '24 22:06 dieg0