2020-10-15 17:09:25.955 16314-16314/kr.co.jjnet.kotlinsmarthm I/ViewRootImpl@4503581[LoginActivity]: Relayout returned: old=(0,0,1080,2280) new=(0,0,1080,2280) req=(1080,2280)8 dur=7 res=0x5 s={false 0} ch=true
2020-10-15 17:09:25.956 16314-16314/kr.co.jjnet.kotlinsmarthm I/ViewRootImpl@4503581[LoginActivity]: stopped(true) old=false
2020-10-15 17:09:25.959 16314-16314/kr.co.jjnet.kotlinsmarthm I/ViewRootImpl@4503581[LoginActivity]: dispatchDetachedFromWindow
2020-10-15 17:09:25.963 16314-16314/kr.co.jjnet.kotlinsmarthm D/InputTransport: Input channel destroyed: ‘daa80e8’, fd=76
2020-10-15 17:09:26.966 16314-16314/kr.co.jjnet.kotlinsmarthm I/ViewRootImpl@e1c2f64[MainActivity]: ViewPostIme pointer 0
2020-10-15 17:09:27.064 16314-16314/kr.co.jjnet.kotlinsmarthm I/ViewRootImpl@e1c2f64[MainActivity]: ViewPostIme pointer 1
2020-10-15 17:09:27.101 16314-16314/kr.co.jjnet.kotlinsmarthm D/AndroidRuntime: Shutting down VM
2020-10-15 17:09:27.102 16314-16314/kr.co.jjnet.kotlinsmarthm E/AndroidRuntime: FATAL EXCEPTION: main
Process: kr.co.jjnet.kotlinsmarthm, PID: 16314
kotlin.UninitializedPropertyAccessException: lateinit property hosts has not been initialized
at com.kakao.sdk.common.KakaoSdk.getHosts(KakaoSdk.kt:37)
at com.kakao.sdk.auth.network.ApiFactoryKt$kapiWithOAuth$2.invoke(ApiFactory.kt:32)
at com.kakao.sdk.auth.network.ApiFactoryKt$kapiWithOAuth$2.invoke(Unknown Source:0)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.kakao.sdk.auth.network.ApiFactoryKt.getKapiWithOAuth(Unknown Source:12)
at com.kakao.sdk.talk.TalkApiClient.(TalkApiClient.kt:33)
at com.kakao.sdk.talk.TalkApiClient$Companion$instance$2.invoke(TalkApiClient.kt:239)
at com.kakao.sdk.talk.TalkApiClient$Companion$instance$2.invoke(TalkApiClient.kt:234)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.kakao.sdk.talk.TalkApiClient$Companion.getInstance(Unknown Source:11)
at kr.co.jjnet.kotlinsmarthm.MainActivity$onCreate$2.onClick(MainActivity.kt:96)
at android.view.View.performClick(View.java:7862)
at android.widget.TextView.performClick(TextView.java:15004)
at android.view.View.performClickInternal(View.java:7831)
at android.view.View.access$3600(View.java:879)
at android.view.View$PerformClick.run(View.java:29359)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
2020-10-15 17:09:27.132 16314-16314/kr.co.jjnet.kotlinsmarthm I/Process: Sending signal. PID: 16314 SIG: 9
위와 같은 에러가 발생하는데요
현재 하고 있는게
https://developers.kakao.com/docs/latest/ko/message/android
참고해서
텍스트를 친구선택없이 나에게 카톡 보내려고 하는거구요
로그인까진 된 상태입니다.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
tvNickname.text = intent.getStringExtra("name")
tvProfile.text = intent.getStringExtra("profile")
Glide.with(this)
.load(intent.getStringExtra("profile"))
.into(imgProfile)
//KAKAO LogOut
btn_custom_login_out.setOnClickListener {
val builder = AlertDialog.Builder(this)
builder.setMessage("로그아웃 하시겠습니까?")
builder.setPositiveButton("확인") { dialogInterface, i ->
UserManagement.getInstance().requestLogout(object : LogoutResponseCallback() {
override fun onCompleteLogout() {
Log.i("Logout", "로그아웃 성공")
val intent = Intent(this@MainActivity, LoginActivity::class.java)
intent.flags =
Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
startActivity(intent)
Log.i("Logout", "로그아웃 성공")
}
})
dialogInterface.dismiss()
}
builder.setNegativeButton("취소") { dialogInterface, i ->
dialogInterface.dismiss()
}
val dialog: AlertDialog = builder.create()
dialog.show()
}
//메시지보내기
btnSendMsg.setOnClickListener {
val defaultText = TextTemplate(
text = """
카카오링크는 카카오 플랫폼 서비스의 대표 기능으로써 사용자의 모바일 기기에 설치된 카카오 플랫폼과 연동하여 다양한 기능을 실행할 수 있습니다.
현재 이용할 수 있는 카카오링크는 다음과 같습니다.
카카오톡링크
카카오톡을 실행하여 사용자가 선택한 채팅방으로 메시지를 전송합니다.
카카오스토리링크
카카오스토리 글쓰기 화면으로 연결합니다.
""".trimIndent(),
link = Link(
webUrl = "https://developers.kakao.com",
mobileWebUrl = "https://developers.kakao.com"
)
)
// btn_custom_login_out.setOnClickListener {
TalkApiClient.instance.sendDefaultMemo(defaultText) { error ->
if (error != null) {
Log.e("보내기", "나에게 보내기 실패", error)
} else {
Log.i("보내기", "나에게 보내기 성공")
}
}
}
}
}
왜 죽는지 모르겠네요.ㅠㅠㅠ. 이것도 메시지 api사용 신청 한다음에 해야하는 기능인건가요?