manifestPlaceholders가 값을 찾지 못할 때 해결방법

2022. 11. 27. 22:45·Android

개발 도중 manifestPlaceholders를 통해 카카오 앱 키를 local.properties 파일에서 읽어오는 기능이 필요했는데 매니페스트에서 읽을 때에만 정상적으로 읽지 못해서 카카오맵이 정상적으로 보이지 않는 이슈가 있었다.

 

원인은 매우 간단했는데, local.properties에서 선언한 앱키를 따옴표 없이 감싸준 이후 정상동작 했다.

 

아래는 참고 할만한 코드를 공유 해본다

// build.gradle
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def KAKAO_API_KEY = properties.getProperty("kakao_api_key")

android {
	...
     defaultConfig {
     ...
     manifestPlaceholders = [KAKAO_API_KEY:KAKAO_API_KEY]
     }
     ...
 }

 

// local.properties
kakao_api_key=abcde.... // 여기서 큰 따옴표(" "), 작은 따옴표(' ')로 감싸면 안됨!!
// android.manifest

        <meta-data
            android:name="com.kakao.sdk.AppKey"
            android:value="${KAKAO_API_KEY}" /> // 요러케 사용

 

나처럼 헤맨 사람이 있다면 얼른 해결하시길 ㅠ

 

'Android' 카테고리의 다른 글

Android AppBar(Toolbar) Menu에 Lottie 사용하기  (0) 2022.12.19
kotlin data class redeclaration error 해결하기  (0) 2022.12.10
Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView  (0) 2022.11.13
android studio에서 실행한 앱이 설치되지 않을 때  (0) 2022.11.06
error: [Dagger/MissingBinding] @dagger.hilt.android.qualifiers.ActivityContext android.content.Context cannot be provided without an @Provides-annotated method. public abstract static class SingletonC implements ArtOnApplication_GeneratedInjector,  (0) 2022.11.05
'Android' 카테고리의 다른 글
  • Android AppBar(Toolbar) Menu에 Lottie 사용하기
  • kotlin data class redeclaration error 해결하기
  • Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
  • android studio에서 실행한 앱이 설치되지 않을 때
HWBB
HWBB
흥미주도개발자
  • HWBB
    코딩공부방
    HWBB
  • 전체
    오늘
    어제
    • 분류 전체보기 (164)
      • 알고리즘 (61)
      • Android (27)
      • Kotlin (0)
      • Java (2)
      • Design Pattern (2)
      • React Native (1)
      • Python (0)
      • TIL (21)
      • Unity (0)
      • React (2)
      • AWS (0)
      • Git (11)
      • MFC (1)
      • Spring (4)
      • Computer Science (4)
      • Vue (4)
      • Infra (6)
      • 박현우 (10)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • 승윤이
  • 공지사항

  • 인기 글

  • 태그

    baekjoon
    Android
    코틀린
    Kotlin
    programmers
    coding
    코딩테스트
    백준
    자바
    안드로이드 스튜디오
    깃허브
    algorithm
    GIT
    AWS
    안드로이드
    Java
    프로그래머스
    github
    android studio
    알고리즘
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
HWBB
manifestPlaceholders가 값을 찾지 못할 때 해결방법
상단으로

티스토리툴바