agrosner / DBFlow

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.
MIT License
4.87k stars 598 forks source link

failed for task ':app:kaptDebugKotlin' java.lang.NoClassDefFoundError: com/grosner/kpoet/TypeNameExtensionsKt #1723

Open anypwx opened 3 years ago

anypwx commented 3 years ago

ISSUE_TEMPLATE

DBFlow Version: 5.0.0-alpha2

Bug or Feature Request: build failure

buildscript { ext.kotlin_version = "1.4.10" repositories { google() mavenCentral() maven { url "https://www.jitpack.io" } } dependencies { classpath 'com.android.tools.build:gradle:4.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    def nav_version = "2.3.4"
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

    classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'

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

}

allprojects { repositories { google() mavenCentral() maven { url "https://www.jitpack.io" } } }

def dbflow_version = "5.0.0-alpha2"

def sqlcipher_version = "4.4.3"
// Use if Kotlin user.
kapt "com.github.agrosner.dbflow:processor:${dbflow_version}"

// Annotation Processor
// if only using Java, use this. If using Kotlin do NOT use this.

// annotationProcessor "com.github.agrosner.dbflow:processor:${dbflow_version}"

// core set of libraries
implementation "com.github.agrosner.dbflow:core:${dbflow_version}"
implementation "com.github.agrosner.dbflow:lib:${dbflow_version}"

// sql-cipher database encryption (optional)

// implementation "com.github.agrosner.dbflow:sqlcipher:${dbflow_version}" // implementation "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"

// RXJava 2 support
implementation "com.github.agrosner.dbflow:reactive-streams:${dbflow_version}"

// Kotlin Coroutines
implementation "com.github.agrosner.dbflow:coroutines:${dbflow_version}"

// Android Architecture Components Paging Library Support
implementation "com.github.agrosner.dbflow:paging:${dbflow_version}"

// Android Architecture Components LiveData Library Support
implementation "com.github.agrosner.dbflow:livedata:${dbflow_version}"

// adds generated content provider annotations + support.
implementation "com.github.agrosner.dbflow:contentprovider:${dbflow_version}"

Description: Execution failed for task ':app:kaptDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution java.lang.reflect.InvocationTargetException (no error message)

jifang commented 3 years ago

I am experiencing the same issue. Then I am trying to solve this issue by adding the following dependency to the build.gralde

    implementation 'com.squareup:javapoet:1.8.0'
    implementation 'com.github.agrosner:KPoet:1.0.0' // version of KPoet

But I am getting the new error

> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform KPoet-1.0.0.jar (com.github.agrosner:KPoet:1.0.0) to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-incremental-desugaring-v2=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/jifang/.gradle/caches/transforms-2/files-2.1/113cdc5e19a30d0ca1d2c0edd4ea825b/jetified-KPoet-1.0.0.jar.
         > Error while dexing.

... ...

Caused by: com.android.tools.r8.utils.b: Error: Method name '@$default' in class 'com.grosner.kpoet.MethodExtensionsKt' cannot be represented in dex format.
1993hzw commented 3 years ago
kapt 'com.squareup:javapoet:1.8.0'
kapt 'com.github.agrosner:KPoet:1.0.0' // version of KPoet