728x90

Kotlin 2

The consumer was configured to find a runtime of a component compatible with Java 11, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.1..

안드로이드 스튜디오 Arctic fox 로 업그레이드 후 그간 미뤄왔던 Gradle 7.0 버전을 적용하기로 했다. 그리고 Gradle 7.0 을 적용하면서 반드시 필요하게 된 Java 11 도 함께 적용하기로 결정하고 기존 프로젝트에서 마이그레이션을 진행하였으나..... 따다다다단..... 머리 씨부리쌋노... -_-; 하라는데로 시키는데로 했는데! A problem occurred configuring root project ''. > Could not resolve all artifacts for configuration ':classpath'. > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10. Required by: pro..

IT/Android 2022.08.09

[Kotlin] 메서드 인터페이스 객체 생성하기(Method Interface object)

안드로이드 개발을 코틀린을 진행하다 보면, 인터페이스 객체를 생성해야 사용해야 하는 경우가 종종 발생한다. 예를 들면, View 클래스의 OnClickListener 같은 것을 만들어서 버튼에 붙여야 한다거나, BottomNavationBar의 OnNavigationItemSelectedListener 를 만들어서 각 이벤트 처리를 하는 등등.. 여러 가지 경우에 아주 흔하게 사용되는 것들이다. 바로 본론을 들어가면 코틀린에서 object를 이용해서 인터페이스 객체를 생성해야 한다. 바로 아래와 같이 코딩이 될 수 있다. private val onNavigationItemSelectedListener = (object: BottomNavigationView.OnNavigationItemSelectedLi..

IT/Android 2019.09.02
728x90