TIL: RN | 인앱 결제 react-native-iap (1) 설치 및 설정 - 221128

Lumpen·2022년 11월 29일
0

RN인앱결제

목록 보기
1/16

react-native-iap

react native의 인앱 구매 기능을 돕는 라이브러리

설치

npm install react-native-iap

iOS

npm install 후에는 pod install 해주며 ㄴ된다

android

안드로이드 스튜디오에서 다음 코드 추가

android/build.gradle
안드로이드 지원을 위해 수정

buildscript {
  ext {
    ...
+   supportLibVersion = "28.0.0"
  }
}

android/build.gradle
안드로이드X를 지원하기 위해 수정

buildscript {
  ext {
    ...
    androidXAnnotation = "1.1.0"
    androidXBrowser = "1.0.0"
    minSdkVersion = 24
    kotlinVersion = "1.5.0"
  }
}

dependencies {
  ...
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}

결제

android/app/build.gradle

play store만 지원할 경우

defaultConfig {
  ...
  missingDimensionStrategy "store", "play"
}

amazon도 함꼐 지원할 경우

android {
  ...
+ flavorDimensions "appstore"
+
+ productFlavors {
+   googlePlay {
+     dimension "appstore"
+     missingDimensionStrategy "store", "play"
+   }
+
+   amazon {
+     dimension "appstore"
+     missingDimensionStrategy "store", "amazon"
+   }
+ }
}

profile
떠돌이 생활을 하는. 실업자는 아니지만, 부랑 생활을 하는

0개의 댓글