grandstaish / paperparcel

Auto-generate Parcelable implementations for Java and Kotlin
https://grandstaish.github.io/paperparcel/
Apache License 2.0
500 stars 29 forks source link

Unresolved reference: PaperParcelXXX using PaperParcel version 2.04 and kotlin 1.1.61 #207

Open leshchenko opened 6 years ago

leshchenko commented 6 years ago

I can't build an apk and get this error msg: Error:(12, 33) Unresolved reference: PaperParcelState

PaperParcelState:

@PaperParcel data class State(
            val count: Int,
            val modificationDate: Date
    ) : PaperParcelable {
        @Transient
        val somethingToExclude = 10000L

        companion object {
            @JvmField
            val CREATOR = PaperParcelState.CREATOR
        }
    }

project build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.1.61'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

module build.gradle:

apply plugin: 'kotlin-kapt'

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.ruslan.myapplication"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'nz.bradcampbell:paperparcel:2.0.4'
    implementation 'nz.bradcampbell:paperparcel-kotlin:2.0.4'
    kapt 'nz.bradcampbell:paperparcel-compiler:2.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

Could you please help me resolve this issue?

grandstaish commented 6 years ago

I just set up a project with those exact gradle files and it worked :/

Got a reproducible sample I could dl?

ruslanle commented 6 years ago

Ok, please let me check on another PC.

leshchenko commented 6 years ago

image On another PC I got the same problem(

grandstaish commented 6 years ago

Others have raised issues like this before too, but I've never been able to reproduce it. If you have a sample project I can look into on github I'll investigate

leshchenko commented 6 years ago

@grandstaish I created such repo https://github.com/leshchenko/PaperParcelIssue.

grandstaish commented 6 years ago

Just downloaded the sample and ran it with no issues.

What's your setup? I'm on a MacBook Pro, Kotlin 1.1.61 (matching plugin), Android Studio 3.0.1 (using the embedded JDK), using the Gradle wrapper in the project.

leshchenko commented 6 years ago

I used the same configuration but on Linux Mint Sonya.

Morteza-Rastgoo commented 4 years ago

Same problem on mac