我们有一个 Kotlin Android 应用程序,我们想集成 rollbar,但到目前为止还没有成功,我们的 gradle 文件:
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'
}
主要活动的行:
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")
使用 Charles,我可以看到该应用程序正在与 rollbar 服务进行通信,但项目仪表板上没有出现任何内容
提前致谢