본문 바로가기
[Gradle] compile(api) vs. implementation [Gradle] compile(api) vs. implementation -gradle 3.0 이 나오면서 compile 은 deprecated 되었고, implementation 또는 api 를 써야 한다. -api dependency는 consumer 에게 library 가 노출이 되어, consumer 의 classpath 에 포함이 된다.implementation 은 consumer 에게 노출되지 않아, compile classpath 에 들어가지 않는다. -implementation 의 장점은 아래와 같다. dependency 가 compile classpath 에 들어가지 않아서 transitive dependency 를 실수로 depend 하지 않는다.더 빠른 compile 이 가능하다.de.. 2019. 2. 6.
[android] Robolectric tutorial [android] Robolectric tutorial http://robolectric.org/ Introduction -test 를 android emulator 나 device 에서 하는 것은 느리다.이 환경에서는 TDD 를 이루기 어렵다. Robolectric 은 unit test framework 로 android sdk jar 를 복제&확장해서 TDD 를 가능하도록 돕는다.JVM 에서 android 코드를 테스트 할 수 있다. -@RunWith(RobolectricTestRunner.class) public class MyActivityTest { @Test public void clickingButton_shouldChangeResultsViewText() throws Exception { .. 2018. 12. 8.
[android] code 와 resource shrink 하자! -android 에서는 ProGuard 를 통해서 사용하지 않는 class, field, method 를 제거할 수 있다.또한 bytecode 를 optimize 하고, 사용하지 않는 code instruction 도 제거하고, 남아있는 코드들에 대해 short name 으로 난독화를 수행한다. Shrink your code -ProGuard 로 code shrinking 을 하려면 gradle 에서 minifyEnable 을 true 를 설정해주면 된다.code shrinking 은 build 시간을 늘리기 때문에 debug 에서는 사용하지 않는 것이 좋고, final apk 에 적용한 후에는 충분한 테스트도 거쳐야 한다. proguard 설정에 따라 에러가 날 수 있다.android { buildTy.. 2018. 11. 23.
[android] Gradle Tutorial #2 Dependency, Android Libraries and Multi-project setup -external library jar 를 사용하려면 compile configuration 을 사용하면 된다. dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) // api 와 implementation 으로 바뀌었다.} android { ...} -compile 은 main app 을 compile 한다.compile 되는 모든 것은 compile classpath 로 잡히고, final APK 에 포함이 된다. 다음과 같은 compile configuration 을 추가할 수 있고,buildType 을 추가하면 자동으로 compile 이 .. 2018. 10. 5.
[android] 잘 쓰지 않지만 유용한 android library 들 ( Spell Checker,Text Recognizer, TimeLogger, MediaProjection, PDF Creation ) [android] 잘 쓰지 않지만 유용한 android library 들 ( Spell Checker,Text Recognizer, TimeLogger, MediaProjection, PDF Creation ) https://blog.autsoft.hu/discovering-the-android-api-part-1/ Spell Checker -TextServicesManager 를 통해 접근 가능하며, API Level 14 부터 사용 가능하며, API Level 16 부터는 문장에 대해서도 check 가능하다. -TextServicesManager.newSpellCheckerSessionhttps://developer.android.com/reference/android/view/textservice/.. 2018. 3. 14.
[Kotlin Tutorial] DSL construction - Chap 11. [Kotlin Tutorial] DSL construction - Chap 11. 참조 : Kotlin in action 11.1. From APIs to DSLs -DSL 을 작성하기 전에 생각해봐야 할 것이 있다. 우리의 (Kotlin?) 궁극적 목표는 가독성과 유지보수성을 최대로 늘리는 것.그것은 곧 좋은 API 를 설계하는 것으로 이어진다. 그렇다면 API 가 clean 하다는 것은 무슨 의미일까?1. 사용자가 읽기 좋은 것. 그것은 name 과 concept 을 잘 잡는 것이다.2. 의미없는 syntax 는 빼고, 최소한의 코드로 code 가 읽기 좋은 것. -Kotlin 에서는 clean API 를 위해서 extension function, infix calls, lambda syntax sh.. 2017. 9. 14.
[Android] 새로운 Dex Compiler 가 나온다네용 -이 글은 D8 이 출시되기 전에 쓰여진 글이라 현재는 deprecated doc 이라고 볼 수 있겠다.D8 에 대한 이야기는 아래 링크를 참조하시길..[android] D8 이 뭐야? -Android APK 를 만들 때 Javac 를 이용해서 bytecode 인 .class 를 만든 후dex compiler 를 이용해서 bytecode 들을 .dex 로 만든다. -Android Studio 3.0 Beta 부터 "D8" 이라고 불리는 새로운 dex compiler 를 사용할 수 있다. D8 은 compile time 도 줄였고, .dex 파일 사이즈도 줄였다..Android 측에서 제공하는 자료에 따르면 Compile Time 은 약 30% 정도 줄었다. 파일 사이즈는 약 5% 정도 줄었다. ( 사이즈.. 2017. 8. 13.
[android] design support library [android] design support library https://android-developers.googleblog.com/2015/05/android-design-support-library.html -android design support library 를 통해서 navigation drawer view, floating labels for editing text, floating action button, snackbar, tabs, motion & scroll framework 등을 2.1 이상 버전에서 사용 가능하다. -gradle 에 아래를 추가하자! compile 'com.android.support:design:22.2.0' 이 녀석은 Support v4 와 AppCompat .. 2017. 8. 4.
[Kotlin Tutorial] Kotlin 소개 - Kotlin : what and why [Kotlin Tutorial] Kotlin 소개 - Kotlin : what and why 참조 : Kotlin in Action -Kotlin 은 Java platform 을 targeting 한 새로운 프로그래밍 언어.Java 코드와 함께 쓰일 수 있다.Android 개발 뿐만 아니라 Server-side 개발에도 쓰일 수 있다. -Java 의 iib, framework 와 함께 쓰일 수 있고, Java 와 비교해 Performance 도 거의 동일하다. 1.1. A Taste of Kotlin -http://try.kotl.in 을 통해 코드 실습을 할 수 있다. -data class Person(val name: String, val age: Int? = null) fun main(args: A.. 2017. 7. 12.
반응형