Java bytecode 분석 Java bytecode 분석 http://arhipov.blogspot.kr/2011/01/java-bytecode-fundamentals.htmlhttps://en.wikipedia.org/wiki/Java_bytecode_instruction_listings -javap 는 java class file disassembler 이다.bytecode 는 위 javap 명령을 통해 볼 수 있다. -public class Foo { private String bar; public String getBar(){ return bar; } public void setBar(String bar) { this.bar = bar; } } 위 코드의 bytecode 는 아래와 같다. public class Foo ex.. 2018. 12. 19. [android] AutoFill Service 란 녀석이 나타났다. -안드로이드 O (Oreo) 부터 autofill service 가 나타났다.이 녀석은 user 가 신용카드 정보, login 정보, 주소, 전화번호 등의 개인정보를 쉽게 auto fill 하는 것을 도와준다. -이 autofill 은 framework 에서 자동으로 다 해주는 것은 아니다.Settings -> System -> Language -> Advanced -> Autofill service 를 통해서 Autofill 을 관리할 service 를 지정할 수 있다.기본 설정은 “Autofill with Google” 이다. -Autofill with Google 은 Chrome 61 이상이 설치되어 있다면 가능하다. -개발자들이 이걸 깊이 알아야 하는 이유가 있나? 아주 깊게까진 아니지만 알아야 .. 2018. 12. 9. [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] Mockito 맛보기 ( test library ) https://www.tutorialspoint.com/mockito/mockito_overview.htm http://www.vogella.com/tutorials/Mockito/article.html https://static.javadoc.io/org.mockito/mockito-core/2.12.0/org/mockito/Mockito.html#mockito - Mockito 는 JUnit 위에서 동작하며 Mocking 과 Verification, Stubbing 을 도와주는 프레임워크이다. ( 이 자체가 testing 하는 framework 는 아니다!! ) Mockito 를 사용하면 Mock 을 만들어서 external dependency 를 제거할 수 있고, code 가 제대로 수행하는지 검증.. 2018. 12. 7. [android] Dagger2 tutorial part2 Dependency Injection in Android https://blog.mindorks.com/introduction-to-dagger-2-using-dependency-injection-in-android-part-1-223289c2a01b - Dependency Injection = Inversion of Control - 한 java class 에서 다른 java class 를 new operator 로 생성하면 test 하는 것이 쉽지 않다. 이를 hard dependency 라고 부른다. - Dagger1 은 reflection 을 사용해서 DI 를 수행했었다. 이는 많은 단점을 가지는데, 우선 느리고, 두번째는 작업이 runtime 에서 수행이 되며, 세번째는 예상치 못한 crash .. 2018. 12. 5. [android] Dagger2 Tutorial 1. Dependency Injection 이란? 1.1. Dependency Injection 이 뭐냐? - 어떤 프로그래밍 언어에든 적용할 수 있는 컨셉이다. 이는 Inversion of Control (control 의 역전)이라고도 불린다. 이 컨셉에 따르면 class 는 dependency 를 정적으로 자신이 결정하는 것이 아니라, 바깥쪽에서 dependency 를 결정해주는 방식이다. - public class MyClass{ private final static Logger logger; public MyClass(Logger logger){ this.logger = logger; logger.info(“This is a log message.”); } } 위 코드의 경우 MyClass 가 .. 2018. 12. 4. [android] Dagger2 for Android Beginners - Dagger 는 static, compile-time dependency injection framework 이다. 기존 버전(1.x)은 Square 에 의해 만들어졌고, 새 버전은 (2.x) Google 에 의해 유지보수되고 있다. - Hard dependency 는.. reusability 를 감소시킨다. testing 을 어렵게 한다. 코드의 scale up 이나 유지보수를 어렵게 한다. - Dependency 에는 다음의 type 이 있다. class, interface ,method/field, direct/indirect - java 에서 new operator 로 instance 를 생성하면, 독립적으로 test 되기가 어렵다. 이를 dependency 라 불린다. - Dependency.. 2018. 12. 3. [android] Oreo 에서는 Wakelock 이 소용 없다?! [android] Oreo 에서는 Wakelock 이 소용 없다?! https://developer.android.com/about/versions/oreo/android-8.0-changes -As one of the changes that Android 8.0 (API level 26) introduces to improve battery life, when your app enters the cached state, with no active components, the system releases any wakelocks that the app holds. App 이 cache 상태에 돌입하고, Active component 가 없으면 system 이 자동으로 wakelock 을 해제한다고 되어 .. 2018. 12. 2. [android] WakefulBroadcastReceiver 를 알아보자! [android] WakefulBroadcastReceiver 를 알아보자! https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver -우선 시작하기에 앞서 이 녀석은 26.1.0 에서 deprecated 되었으며 그 이유는..Android O 에서 background restriction 이 생겼기 때문이다.그래서 이 녀석 대신 JobScheduler 를 사용하는 것이 권장된다. -이 녀석은 원래 BroadcastReceiver 의 한 형태로, device wakeup event 를 받아서 그 작업 처리를 Service 에 넘기는 역할을 했던 녀석이다. 또한 그 과정중에 device 가 sleep.. 2018. 12. 1. 반응형 이전 1 ··· 15 16 17 18 19 20 21 ··· 125 다음