Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved reference: Napier #28

Closed
pecanw opened this issue Nov 14, 2019 · 1 comment
Closed

Unresolved reference: Napier #28

pecanw opened this issue Nov 14, 2019 · 1 comment
Labels
question Further information is requested

Comments

@pecanw
Copy link

pecanw commented Nov 14, 2019

I've got an issue when trying to use the Napier logging library in the kotlin mpp project. The symptoms are exactly the same as described in the Issue 26 which has been closed.

To test the issue out of my project I have downloaded the official Kotlin mpp example and just upgraded the versions of gradle and kotlin and added the Napier library. You can find the project here:
mpp-example.zip

I'm getting the error e: ...\mpp-example\greeting\src\commonMain\kotlin\common.kt: (3, 33): Unresolved reference: Napier

@AAkira
Copy link
Owner

AAkira commented Nov 15, 2019

You should implement the napier platform plugin, Android or iOS or JVM or JS.

This problem is not faulted by this library.
Your gradle file is wrong.

  • current
kotlin {
    targets {
        fromPreset(presets.android, 'androidLib')

        def buildForDevice = project.findProperty("device")?.toBoolean() ?: false
        def iosPreset = (buildForDevice) ? presets.iosArm64 : presets.iosX64
        fromPreset(iosPreset, 'ios') {
            binaries {
                framework {
                    // Disable bitcode embedding for the simulator build.
                    if (!buildForDevice) {
                        embedBitcode("disable")
                    }
                }
            }
        }
    }

    sourceSets {
        commonMain {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
                implementation 'com.github.aakira:napier:1.0.0'
            }
        }
        commonTest {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-test-common'
                implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
            }
        }
        andriodTest {
            dependencies {
                implementation 'com.github.aakira:napier-android:1.0.0'
            }
        }
    }
}
  • after
        andriodLibMain {
            dependencies {
                implementation 'com.github.aakira:napier-android:1.0.0'
            }
        }

@AAkira AAkira added the question Further information is requested label Nov 15, 2019
@AAkira AAkira closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants