rollbar-java
rollbar-java copied to clipboard
Android data is sent but doesn't appear on Rollbar
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
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.
@dieg0 I haven't heard back so I'm going to close this issue until I receive more information from you.
Hi @jessewgibbs . This is my Charles log.
Can you export the full text content?
MY XML FILE
@jessewgibbs
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?
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..
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?
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!
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
@rokob any ideas about how to troubleshoot this further?
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
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.
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!
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.
@dieg0 are you still unable to integrate rollbar? We believe this works as expected and would like to confirm before closing this issue.
No longer working on that project, no problem if you close the issue