grpc / grpc-kotlin

Kotlin gRPC implementation. HTTP/2 based RPC
https://grpc.io/docs/languages/kotlin
Apache License 2.0
1.2k stars 165 forks source link

error: incompatible types: NonExistentClass cannot be converted to Annotation @error.NonExistentClass() #352

Open Parabyt opened 2 years ago

Parabyt commented 2 years ago

I am getting the above titled error. Below is my gradle app file.

  apply plugin: 'com.android.application'

  apply plugin: 'com.google.firebase.crashlytics'

  apply plugin: 'com.heapanalytics.android'

  apply plugin: 'kotlin-android'

  apply plugin: 'kotlin-android-extensions'

  apply plugin: 'kotlin-kapt'

  apply plugin: 'kotlin-android'

  apply from: '../jacoco.gradle'

  //def keystorePropertiesFile = rootProject.file("keystore.properties")
  //def keystoreProperties = new Properties()
  //
  //def isRunningOnCI = System.getenv("CI") == "true"
  //
  //if (!isRunningOnCI) {
  //    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  //}

  def isTestModeEnabled() {
      def value = project.getProperties().get("testModeEnabled")
      return value != null ? value : "false"
  }

  android {
      compileSdkVersion 30
      buildToolsVersion '29.0.3'
      defaultConfig {
          applicationId "com.perchwell.re"
          minSdkVersion 21
          targetSdkVersion 30
          versionCode 341
          versionName "5.3.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
          multiDexEnabled true

          buildConfigField "String", "TERMS_AND_PRIVACY_LOCAL_URL", '"file:///android_asset/termsAndPrivacy.html"'

          buildConfigField "String", "GOOGLE_MAPS_API_KEY", "\"${project.findProperty("GOOGLE_MAPS_API_KEY") ?: ""}\""

          buildConfigField "boolean", "TEST_MODE_ENABLED", isTestModeEnabled()

          resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
          resValue "string", "intercom_api_key", (project.findProperty("INTERCOM_API_KEY") ?: "")
          resValue "string", "intercom_app_id", (project.findProperty("INTERCOM_APP_ID") ?: "")
      }
      kapt {
          correctErrorTypes = true
          generateStubs = true
      }
      testOptions {
          unitTests.includeAndroidResources = true
          reportDir = "$rootDir/test-reports"
          resultsDir = "$rootDir/test-results"
      }
      // remove compile options after full kotlin conversion
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      // uncomment kotlin options after full kotlin conversion
      /*kotlinOptions {
          jvmTarget = "1.8"
      }*/

  //    signingConfigs {
  //        debug {
  //            if (!isRunningOnCI) {
  //                storeFile file(keystoreProperties['debugStoreFile'])
  //                storePassword keystoreProperties['debugStorePassword']
  //                keyAlias keystoreProperties['debugKeyAlias']
  //                keyPassword keystoreProperties['debugKeyPassword']
  //            } else {
  //                storeFile file(System.getenv("debugStoreFile"))
  //                storePassword System.getenv("debugStorePassword")
  //                keyAlias System.getenv("debugKeyAlias")
  //                keyPassword System.getenv("debugKeyPassword")
  //            }
  //        }
  //        dev {
  //            if (!isRunningOnCI) {
  //                storeFile file(keystoreProperties['devStoreFile'])
  //                storePassword keystoreProperties['devStorePassword']
  //                keyAlias keystoreProperties['devKeyAlias']
  //                keyPassword keystoreProperties['devKeyPassword']
  //            } else {
  //                storeFile file(System.getenv("devStoreFile"))
  //                storePassword System.getenv("devStorePassword")
  //                keyAlias System.getenv("devKeyAlias")
  //                keyPassword System.getenv("devKeyPassword")
  //            }
  //        }
  //        staging {
  //            if (!isRunningOnCI) {
  //                storeFile file(keystoreProperties['stagingStoreFile'])
  //                storePassword keystoreProperties['stagingStorePassword']
  //                keyAlias keystoreProperties['stagingKeyAlias']
  //                keyPassword keystoreProperties['stagingKeyPassword']
  //            } else {
  //                storeFile file(System.getenv("stagingStoreFile"))
  //                storePassword System.getenv("stagingStorePassword")
  //                keyAlias System.getenv("stagingKeyAlias")
  //                keyPassword System.getenv("stagingKeyPassword")
  //            }
  //        }
  //        prod {
  //            if (!isRunningOnCI) {
  //                storeFile file(keystoreProperties['prodStoreFile'])
  //                storePassword keystoreProperties['prodStorePassword']
  //                keyAlias keystoreProperties['prodKeyAlias']
  //                keyPassword keystoreProperties['prodKeyPassword']
  //            } else {
  //                storeFile file(System.getenv("prodStoreFile"))
  //                storePassword System.getenv("prodStorePassword")
  //                keyAlias System.getenv("prodKeyAlias")
  //                keyPassword System.getenv("prodKeyPassword")
  //            }
  //        }
  //    }

      flavorDimensions "api"
      productFlavors {
          dev {
              dimension "api"
              buildConfigField "String", "BASE_URL", '"https://dev.perchwell.com"'
              buildConfigField "String", "TERMS_AND_PRIVACY_URL", '"https://dev.perchwell.com/terms?nochrome=1"'
              resValue "string", "heap_app_id", (project.findProperty("HEAP_DEV_APP_ID") ?: "")
              applicationIdSuffix = ".dev"
              manifestPlaceholders = [
                      appIcon: "@mipmap/app_icon_dev",
                      appIconRound: "@mipmap/app_icon_dev_round",
                      appDomainUrl: "dev.perchwell.com"
              ]
          }
          staging {
              dimension "api"
              buildConfigField "String", "BASE_URL", '"https://staging.perchwell.com"'
              buildConfigField "String", "TERMS_AND_PRIVACY_URL", '"https://staging.perchwell.com/terms?nochrome=1"'
              resValue "string", "heap_app_id", (project.findProperty("HEAP_DEV_APP_ID") ?: "")
              applicationIdSuffix = ".staging"
              manifestPlaceholders = [
                      appIcon: "@mipmap/app_icon_staging",
                      appIconRound: "@mipmap/app_icon_staging_round",
                      appDomainUrl: "staging.perchwell.com"
              ]
          }
          prod {
              dimension "api"
              buildConfigField "String", "BASE_URL", '"https://www.perchwell.com"'
              buildConfigField "String", "TERMS_AND_PRIVACY_URL", '"https://www.perchwell.com/terms?nochrome=1"'
              resValue "string", "heap_app_id", (project.findProperty("HEAP_PROD_APP_ID") ?: "")
              manifestPlaceholders = [
                      appIcon: "@mipmap/app_icon_prod",
                      appIconRound: "@mipmap/app_icon_prod_round",
                      appDomainUrl: "www.perchwell.com"
              ]
          }
      }
      buildTypes {
          debug {
              applicationIdSuffix = ".debug"
              debuggable true

              resValue "string", "app_name", "Perchwell Debug"
          }
          release {
              debuggable false

              resValue "string", "app_name", "Perchwell"

              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

  //            productFlavors.getByName("dev").signingConfig signingConfigs.getByName("dev")
  //            productFlavors.getByName("staging").signingConfig signingConfigs.getByName("staging")
  //            productFlavors.getByName("prod").signingConfig signingConfigs.getByName("prod")

              android.applicationVariants.all { variant ->
                  variant.outputs.all {
                      String variantName = variant.name.replaceAll("([a-z])([A-Z]+)", "\$1-\$2").toLowerCase()
                      if (!isRunningOnCI) {
                          outputFileName = "perchwell-${variantName}-v${variant.versionName} (${variant.versionCode}).apk"
                      } else {
                          variantName = variantName.substring(0, variantName.indexOf("-"))
                          variantName = variantName.substring(0, 1).toUpperCase() + variantName.toLowerCase().substring(1)
                          outputFileName = "Perchwell ${variantName}.apk"
                      }
                  }
              }

              ext.heapEnabled = true

              testCoverageEnabled = false
          }
      }
  }

  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])

      implementation name:'google-maps-utils', ext:'aar'

      implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion}"

      implementation 'androidx.appcompat:appcompat:1.2.0'
      implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

      implementation 'androidx.legacy:legacy-support-v4:1.0.0'

      testImplementation 'junit:junit:4.13'
      testImplementation 'org.mockito.kotlin:mockito-kotlin:3.2.0'
      testImplementation "com.google.truth:truth:1.1.3"
      androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })

      implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
      implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

      implementation 'com.jakewharton.rxbinding4:rxbinding-core:4.0.0'

      implementation "com.squareup.okhttp3:okhttp:${okHttpVersion}"
      implementation "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}"

      implementation "com.google.dagger:dagger:${daggerVersion}"
      annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"

      kapt "com.google.dagger:dagger-compiler:$daggerVersion"
      kapt "com.google.dagger:dagger-android-processor:$daggerVersion"

      implementation "com.jakewharton:butterknife:${butterknifeVersion}"
      annotationProcessor "com.jakewharton:butterknife-compiler:${butterknifeVersion}"

      kapt "com.jakewharton:butterknife:${butterknifeVersion}"
      kapt "com.jakewharton:butterknife-compiler:${butterknifeVersion}"

      implementation 'androidx.recyclerview:recyclerview:1.1.0'
      implementation 'com.google.android.material:material:1.3.0'

      implementation 'com.hannesdorfmann:adapterdelegates4:4.3.0'

      implementation 'com.annimon:stream:1.1.9'

      implementation "com.google.android.gms:play-services-auth:19.0.0"
      implementation "com.google.android.gms:play-services-maps:17.0.0"

      // use google-maps-utils for now instead
      //implementation 'com.google.maps.android:android-maps-utils:1.3.1'

      implementation 'de.hdodenhof:circleimageview:3.1.0'

      implementation 'com.squareup.picasso:picasso:2.71828'

      implementation 'net.danlew:android.joda:2.10.9.1'

      // some problems with updating this dependency to 1.9.12 version
      implementation 'uk.com.robust-it:cloning:1.9.9'

      implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

      implementation 'com.alexvasilkov:gesture-views:2.7.1'

      debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'

      implementation 'org.apache.commons:commons-lang3:3.12.0'

      implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'

      implementation 'com.heapanalytics.android:heap-android-client:1.9.0'

      implementation 'io.intercom.android:intercom-sdk-base:9.1.0'
      implementation 'io.intercom.android:intercom-sdk-fcm:9.1.0'

      implementation 'jp.wasabeef:recyclerview-animators:4.0.2'

      implementation 'com.google.android:flexbox:2.0.1'

      implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'

      implementation 'com.dinuscxj:recyclerrefreshlayout:2.0.5'

      implementation 'com.airbnb.android:lottie:3.5.0'

      implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'

      implementation 'io.github.jamsesso:json-logic-java:1.0.5'

      implementation "me.henrytao:recycler-pager-adapter:2.1.0"

      implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'

      implementation 'com.ct7ct7ct7.androidvimeoplayer:library:1.2.2'

      implementation 'com.google.firebase:firebase-analytics-ktx:18.0.2'
      implementation 'com.google.firebase:firebase-crashlytics-ktx:17.4.1'

      implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'

      implementation 'com.facebook.shimmer:shimmer:0.5.0'

      implementation "com.github.moxy-community:moxy:$moxyVersion"
      kapt "com.github.moxy-community:moxy-compiler:$moxyVersion"
      implementation "com.github.moxy-community:moxy-androidx:$moxyVersion"
      implementation "com.github.moxy-community:moxy-ktx:$moxyVersion"

      implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
      implementation "androidx.lifecycle:lifecycle-process:2.3.1"
  }

  apply plugin: 'com.google.gms.google-services'

  apply plugin: 'realm-android'

Below is my gradle Android file.

buildscript {
    ext.okHttpVersion = '4.9.1'
    ext.daggerVersion = '2.33'
    ext.butterknifeVersion = '10.2.1'
    ext.leakCanaryVersion = '2.7'
    ext.kotlinVersion = '1.4.32'
    ext.moxyVersion = '2.2.1'

    repositories {
        google()
        jcenter()
        maven {
            url 'https://heap-maven-public.s3.amazonaws.com/android-testing'
        }
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.2'
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
        classpath "io.realm:realm-gradle-plugin:6.0.2"
        classpath 'com.heapanalytics.android:heap-android-gradle:1.9.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.16.0"
    }
}

apply from: "$rootDir/detekt.gradle"

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven {
            url 'https://heap-maven-public.s3.amazonaws.com/android-testing'
        }
        flatDir {
            dirs 'libs'
        }
    }
}

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

I don't know the source of this error and have tried all the available suggested solution but cannot unable to resolve this.

jamesward commented 2 years ago

I'm not sure what the problem might be. If you can create a small reproducible sample project, that'd help.