PDA

View Full Version : خطای app:kaptDebugKotlin



ms-ninja
دوشنبه 10 خرداد 1400, 00:11 صبح
با سلام خدمت تمامی دوستان گرامی


3 روزی است درگیر خطاب عجیبی هستم



Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)




* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.









Gradle app

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'




ext.versionMajor = 1
ext.versionMinor = 0
ext.versionPatch = 6
ext.isSnapshot = false // set to false when publishing new releases
ext.minimumSdkVersion = 19
ext.targetSdkVersion = 30


private Integer GenerateVersionCode() {
return ext.minimumSdkVersion * 10000000 + ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch
}


private String GenerateVersionName() {
String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.vers ionPatch}"


if (ext.isSnapshot) {
versionName += "-" + "SNAPSHOT"
}
return versionName;
}


android {
ndkVersion "21.3.6528147"
compileSdkVersion project.ext.targetSdkVersion


applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
defaultConfig {
applicationId "com.nodroon.nod"
minSdkVersion 24
targetSdkVersion project.ext.targetSdkVersion
versionCode GenerateVersionCode()
versionName GenerateVersionName()
multiDexEnabled true


testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
externalNativeBuild {
cmake {
arguments "-DANDROID_CPP_FEATURES=rtti exceptions"
}
}
archivesBaseName = "$applicationId-v$versionName-$versionCode"
}




buildTypes {
debug {
// applicationIdSuffix versionClassifier
debuggable true
}
release {
minifyEnabled false
shrinkResources false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
// 'proguard-rules.pro'
}
}


compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
doNotStrip "*/armeabi-v7a/libgojni.so"
doNotStrip "*/arm64-v8a/libgojni.so"
doNotStrip "*/x86/libgojni.so"
doNotStrip "*/x86_64/libgojni.so"
}
splits {
abi {
enable true
reset()
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
universalApk true
}
}
}


repositories {
flatDir {
dirs 'src/libs'
}
}


dependencies {
implementation 'com.bugfender.sdk:android:3.0.8'
implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.github.stealthcopter:AndroidNetworkTools:0.4. 5.3'
implementation 'com.google.android.material:material:1.4.0-beta01'
implementation 'androidx.activity:activity:1.3.0-alpha08'
implementation 'androidx.fragment:fragment:1.4.0-alpha01'
implementation 'androidx.appcompat:appcompat:1.4.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.core:core:1.6.0-beta01'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation files('src\\libs\\XposedBridgeApi-54.jar')
implementation files('src\\libs\\acra-4.5.0.jar')
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.wireguard.android:tunnel:1.0.20210211'
implementation 'com.github.andyxialm:ColorDialog:1.0.0'


annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
def camerax_version = '1.1.0-alpha04'
// CameraX core library using camera2 implementation
implementation "androidx.camera:camera-camera2:${camerax_version}"
// CameraX Lifecycle Library
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
// CameraX View class
implementation 'androidx.camera:camera-view:1.0.0-alpha24'
implementation 'com.google.mlkit:barcode-scanning:16.1.2'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation "io.reactivex.rxjava3:rxjava:3.0.6"
implementation("io.reactivex.rxjava3:rxkotlin:3.0.1")
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
def room_version = '2.3.0'
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation 'androidx.multidex:multidex:2.0.1'
def coroutinesVersion = "1.3.9"
def roomVersion = '2.3.0'
def workVersion = '2.5.0'
api('androidx.core:core-ktx:1.6.0-beta01')


// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies


api('androidx.fragment:fragment-ktx:1.4.0-alpha01')
api('androidx.lifecycle:lifecycle-common-java8:2.3.1')
api('androidx.lifecycle:lifecycle-livedata-core-ktx:2.3.1')
api("androidx.preference:preference:1.1.1")
api("androidx.room:room-runtime:$roomVersion")
api("androidx.work:work-runtime-ktx:$workVersion")
api("androidx.work:work-gcm:$workVersion")
api("com.google.code.gson:gson:2.8.6")


api("com.jakewharton.timber:timber:4.7.1")
api('dnsjava:dnsjava:3.3.1')
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
api("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion")
kapt("androidx.room:room-compiler:$roomVersion")


}



Gradle

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


buildscript {
ext {
kotlinVersion = '1.3.72'
springBootVersion = '2.0.4.RELEASE'
}
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
classpath 'com.google.gms:google-services:4.3.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}


allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}


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



حتی چیز******کن هم روشنه


با تشکر از دوستان

elias102
چهارشنبه 12 خرداد 1400, 11:57 صبح
سلام دوست عزیز کد زیر را در ترمینال اندروید استودیو اجرا کنین تا مشکل به صورت دقیق تر به شما گزارش بشه:


./gradlew clean build

ms-ninja
دوشنبه 17 خرداد 1400, 16:41 عصر
C:\Users\Dr.NINJA\StudioProjects\gramotel>gradlew clean build


Welcome to Gradle 6.8.3!


Here are the highlights of this release:
- Faster Kotlin DSL script compilation
- Vendor selection for Java toolchains
- Convenient execution of tasks in composite builds
- Consistent dependency resolution


For more details see https://docs.gradle.org/6.8.3/release-notes.html


Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details


> Configure project :app
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.github.bumptech.glide:compiler:4.12.0'.
WARNING:: Using flatDirs should be avoided because it doesn't support any meta-data formats.
Currently detected usages:
- repository flatDir used in: project ':app'
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'gramotel', project ':app'


> Task :app:mergeDebugResources
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\res\values\strings.xml:371:4: Multiple substitutions specified in non-positional format of string resource string/get_time. Did you mean to add the formatted="false" attribute?
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\res\values\strings.xml:37:4: Multiple substitutions specified in non-positional format of string resource string/service_subscription_working. Did you mean to add the formatted=
"false" attribute?


> Task :app:processDebugMainManifest
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\AndroidManifest.xml:30:5-78 Warning:
Element uses-permission#android.permission.ACCESS_NETWORK_STATE at AndroidManifest.xml:30:5-78 duplicated with element declared at AndroidManifest.xml:21:5-79
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\AndroidManifest.xml:31:5-78 Warning:
Element uses-permission#android.permission.CHANGE_NETWORK_STATE at AndroidManifest.xml:31:5-78 duplicated with element declared at AndroidManifest.xml:22:5-79
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\AndroidManifest.xml:32:5-67 Warning:
Element uses-permission#android.permission.INTERNET at AndroidManifest.xml:32:5-67 duplicated with element declared at AndroidManifest.xml:18:5-67
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\AndroidManifest.xml:33:5-80 Warning:
Element uses-permission#android.permission.READ_EXTERNAL_STORAG E at AndroidManifest.xml:33:5-80 duplicated with element declared at AndroidManifest.xml:23:5-80
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\AndroidManifest.xml:145:9-151:19 Warning:
Element service#de.blinkt.open***.core.Open***Service at AndroidManifest.xml:145:9-151:19 duplicated with element declared at AndroidManifest.xml:106:9-112:19


> Task :app:mergeDebugNativeLibs
More than one file was found with OS independent path 'lib/x86/libbarhopper_v2.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or errors
at runtime. Future versions of the Android Gradle Plugin will throw an error in this case.
More than one file was found with OS independent path 'lib/x86_64/libbarhopper_v2.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or erro
rs at runtime. Future versions of the Android Gradle Plugin will throw an error in this case.
More than one file was found with OS independent path 'lib/armeabi-v7a/libbarhopper_v2.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or
errors at runtime. Future versions of the Android Gradle Plugin will throw an error in this case.
More than one file was found with OS independent path 'lib/arm64-v8a/libbarhopper_v2.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or e
rrors at runtime. Future versions of the Android Gradle Plugin will throw an error in this case.


> Task :app:mergeReleaseResources
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\res\values\strings.xml:371:4: Multiple substitutions specified in non-positional format of string resource string/get_time. Did you mean to add the formatted="false" attribute?
C:\Users\Dr.NINJA\StudioProjects\gramotel\app\src\ main\res\values\strings.xml:37:4: Multiple substitutions specified in non-positional format of string resource string/service_subscription_working. Did you mean to add the formatted=
"false" attribute?


> Task :app:kaptGenerateStubsDebugKotlin FAILED


FAILURE: Build failed with an exception.


* What went wrong:
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\Android\Android Studio\jre\java' used by Gradle. Make sure Gradle is running on a JDK, not JRE.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


* Get more help at https://help.gradle.org


Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warni ngs


BUILD FAILED in 47s
36 actionable tasks: 36 executed


C:\Users\Dr.NINJA\StudioProjects\gramotel>