icerockdev / moko-resources

Resources access for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1.07k stars 120 forks source link

gradle: Required value was null. #102

Closed geckogecko closed 4 years ago

geckogecko commented 4 years ago

I am following the Installation guide from the readme to include moko-resources into my mpp project. My root build.gradle

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
        maven { url = "https://dl.bintray.com/icerockdev/plugins" }
    }
    dependencies {
        def nav_version = "2.3.0-beta01"

        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.squareup.sqldelight:gradle-plugin:1.4.0'
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
        classpath "dev.icerock.moko:resources-generator:0.11.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: 'gradle/jacoco.gradle'

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        flatDir {dirs 'libs'}
        maven { url = "https://dl.bintray.com/icerockdev/moko" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

But when I try to include it into my project build.gradle.kts with:

plugins {
    id("com.android.library")
    kotlin("multiplatform")
    kotlin("plugin.serialization") version "1.3.70"
    id("com.squareup.sqldelight")
    id("dev.icerock.mobile.multiplatform-resources")
}

dependencies {
    commonMainApi("dev.icerock.moko:resources:0.11.0")
}

I receive the gradle error: Required value was null.

Alex009 commented 4 years ago

hello, @geckogecko

you not setup all required configuration. https://github.com/icerockdev/moko-resources#installation

multiplatformResources {
    multiplatformResourcesPackage = "org.example.library"
    iosBaseLocalizationRegion = "en" //optional, default "en"
    multiplatformResourcesSourceSet = "commonClientMain"  // optional, default "commonMain"
}

multiplatformResourcesPackage is not optional, it's required

geckogecko commented 4 years ago

@Alex009 oh wow totally forgot that one.. Thanks