Skip to content

Commit

Permalink
Merge pull request #266 from klarna/kotlin-plugin-not-found-fix
Browse files Browse the repository at this point in the history
Kotlin plugin not found fix
  • Loading branch information
NMGuner authored Aug 22, 2024
2 parents 8a90d03 + e59916e commit d0b0e6b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
31 changes: 16 additions & 15 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,34 @@ buildscript {
}

ext.getExtOrDefault = { name ->
getExtOrFallback(name, project.properties["lib_" + name])
getExtOrFallback(name, project.properties["KlarnaMobileSDKRN_" + name])
}

repositories {
google()
gradlePluginPortal()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:${getExtOrDefault('gradlePluginVersion')}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
}
}

def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["KlarnaMobileSDKRN_" + name]
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["KlarnaMobileSDKRN_" + name]).toInteger()
}

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["lib_" + name]
def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["lib_" + name]).toInteger()
}
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
Expand All @@ -51,6 +46,12 @@ def supportsNamespace() {
return major >= 8
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

android {
if (supportsNamespace()) {
namespace "com.klarna.mobile.sdk.reactnative"
Expand Down
12 changes: 6 additions & 6 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ kotlin.code.style=official
android.useAndroidX=true
android.enableJetifier=true

lib_gradlePluginVersion=7.2.1
lib_kotlinVersion=1.7.0
lib_minSdkVersion=21
lib_targetSdkVersion=31
lib_compileSdkVersion=31
lib_ndkVersion=21.4.7075529
KlarnaMobileSDKRN_gradlePluginVersion=7.2.1
KlarnaMobileSDKRN_kotlinVersion=1.7.0
KlarnaMobileSDKRN_minSdkVersion=21
KlarnaMobileSDKRN_targetSdkVersion=31
KlarnaMobileSDKRN_compileSdkVersion=31
KlarnaMobileSDKRN_ndkVersion=21.4.7075529

0 comments on commit d0b0e6b

Please sign in to comment.