Skip to content

[테크니컬 라이팅] 디랙(허찬) 미션 제출합니다.#1063

Open
doabletuple wants to merge 12 commits intowoowacourse:doabletuplefrom
doabletuple:level4
Open

[테크니컬 라이팅] 디랙(허찬) 미션 제출합니다.#1063
doabletuple wants to merge 12 commits intowoowacourse:doabletuplefrom
doabletuple:level4

Conversation

@doabletuple
Copy link

No description provided.

@@ -0,0 +1,272 @@
## 소개

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

최상단 또는 파일 이름에 이 글의 주제가 적혀있으면 좋을 것 같아요. 👍

글을 읽기 전에 이 글에 들어오게 되는 이유가 될 것 같습니다. 🙂


안드로이드 앱을 빌드할 때 R8이라는 도구를 사용해 앱을 최적화할 수 있습니다. **앱 최적화**(app optimization)는 앱의 코드에서 기능적으로 필요하지 않은 부분을 제거하고 단순화해 앱을 더 작고 빠르게 만드는 과정입니다.

이 글을 통해 R8을 사용한 안드로이드 앱 최적화를 소개하고, 적용 시 발생할 수 있는 오류와 트러블슈팅 방법을 간단히 설명하고자 합니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 내용 이후에 대상으로 하는 독자가 쓰여있으면 해당 독자들이 글에 더 몰입할 수 있을 것 같아요. 😁

level4.md Outdated
Comment on lines +176 to +188
앱 최적화를 활성화하는 것 자체는 간단합니다. `build.gradle` 파일에 다음 코드를 추가해주기만 하면 됩니다.

```kotlin
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
)
// ...
}
}
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProGuard와 R8, 두 도구를 위에서 소개해주셨습니다. 👀

때문에 해당 코드가 어떤 도구를 사용한 것인지 주석을 통해 명시해주시면 더욱 좋을 것 같습니다. 👍

level4.md Outdated

우리가 직접 작성한 코드가 리플렉션을 쓰지 않더라도 안심할 수는 없습니다. 사용하는 외부 라이브러리 중 리플렉션을 쓰는 것이 있을 수 있으니까요. 외부 라이브러리도 앱 코드의 일부가 되기 때문에, 적절한 keep rule을 추가해주지 않으면 앱 축소로 인한 문제가 발생할 수 있습니다.

물론 [OkHttp](https://square.github.io/okhttp/features/r8_proguard/#r8-proguard)나 [Retrofit](https://square.github.io/okhttp/features/r8_proguard/#r8-proguard)처럼 필요한 keep rule가 내장돼있어 개발자가 직접 규칙을 추가해주지 않아도 되는 친절한 라이브러리도 있습니다. 혹은 공식 문서에서 어떤 규칙을 추가해야 하는지 안내해주는 라이브러리도 있고요. 하지만 라이브러리가 자체가 안드로이드를 염두하지 않고 제작됐을 수도 있고, 그 외에도 어떤 이유로든 라이브러리가 R8 친화적이지 않아서 개발자가 직접 적절한 keep rule을 추가해줘야 할 수 있습니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

두 링크 모두 OkHttp에 관한 내용인 것 같아요. 👀

Copy link

@giovannijunseokim giovannijunseokim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 읽었습니다. 코멘트를 몇 개 남겨두었는데, 도움이 되었으면 좋겠습니다. 😁

추가적으로 코멘트 남겨봐요.

  • 마지막 부분에 결론을 추가해서 글 내용을 한 번 요약해주시면 글 내용이 상기되어 중요한 부분들이 오래 기억에 남을 것 같아요.

글 작성 고생하셨습니다! 🔥

Copy link

@tobae-time tobae-time left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소제목이 명사로 되어 있는데, 읽기에 끊어지는 느낌이 드는 것 같아요~ 문장으로 이루어지면 더 좋을 것 같습니다~

level4.md Outdated

앱 최적화가 문제를 일으켜서 커스텀 keep rule을 추가해야 한다면, 앱 모듈의 루트 디렉터리에 `proguard-rules.pro`파일을 만들어서 keep rule을 추가하고, 빌드 설정에 다음과 같이 해당 파일을 사용하겠다고 명시해주면 됩니다. 일반적으로는 안드로이드 프로젝트를 생성할 때 자동으로 해당 파일도 생성됩니다.

```jsx

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kotlin으로 바꿔주세요

level4.md Outdated

### Keep rules

**Keep rule**은 ProGuard와 R8한테 "이 코드는 건들면 안돼"라고 알려주는 규칙입니다. 아래에서 설명될 원인들로 인해 일부 코드에는 최적화를 적용하면 오류가 발생할 수 있기 때문입니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안돼 -> 안 돼가 올바른 표현인 것 같아요~

Copy link

@tobae-time tobae-time left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

마무리 멘트가 있으면 좋을 것 같습니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants