Tech

gradle.properties 파일을 지역적으로 관리하기

각종 빌드 옵션이나 외부 프로젝트 경로를 gradle.properties 파일에 설정해두고 build.gradle에서 이를 참조하도록 설정하면 빌드를 관리하기가 편하다. 그러나 여러 명이 다양한 환경에서 개발하게될 경우, gradle.properties 파일이 버전관리 시스템에 들어가면 매우 불편한 상황이 생긴다. 2명의 개발자가 어떤 외부 라이브러리 프로젝트를 참조하기 위해 ext_lib_path라는 property를 아래와 같이 설정해두고 작업을 한다고 가정해보자. 개발자1: ext_lib_path=C:\Users\dev1\Libraries\ext_lib 개발자2: ext_lib_path=/home/dev2/libs/ext_lib 라이브러리의 위치는 물론 […]

gradle.properties 파일을 지역적으로 관리하기 Read More »

BroadcastReceiver 사용 시 유의점

BroadcastReceiver는 onReceive가 처리되는 동안만 존재한다. 즉, onReceive()가 처리되는 도중에 또다시 같은 인스턴스의 onReceive()가 호출되지는 않는다. 매번 새로운 인스턴스가 생성된다. 비동기처리를 통해 결과를 가져오는 작업을 못함 비동기처리가 진행되는 도중 onReceive가 리턴하고나면 BroadcastReceiver 인스턴스는 이미 invalid 상태 API 11부터는 goAsync()를 통해 가능하긴 하다. PendingResult를 가지고 있다가 다 완료되면 PendingResult.finish()를 호출해서 종료 다이얼로그 같은 거 못 띄움 NotificationManager

BroadcastReceiver 사용 시 유의점 Read More »

Python에서 sqlite로 파일경로 insert 시 인코딩 에러

sqlite3 데이터베이스에 파일 경로를 삽입하니 아래와 같은 에러가 발생했다. sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. 문자열을 아래와 같이 utf-8로 디코딩하면 해결된다. ‘path_to_somewhere’.decode(‘utf-8’)  

Python에서 sqlite로 파일경로 insert 시 인코딩 에러 Read More »

adb를 통해서 임의의 인텐트 시작하기

커스텀 URL을 처리하거나 기타 암묵적(implicit) 인텐트를 처리하는 기능을 구현할 때 adb를 통해서 인텐트를 발생시키면 편리하게 테스트할 수 있다. 아래와 같은 형식으로 실행하면 된다. adb shell am start -a <action> -d <data> 예시 adb shell am start -a android.intent.action.VIEW -d http://www.example.com  

adb를 통해서 임의의 인텐트 시작하기 Read More »