gpt4 book ai didi

AndroidStudio 无法同步 Gradle 文件

转载 作者:搜寻专家 更新时间:2023-11-01 07:42:00 27 4
gpt4 key购买 nike

最近,AndroidStudio 停止为我工作。

如果我同步到 gradle 文件,我会得到这个错误:

Gradle 同步失败:org/jetbrains/kotlin/kapt/idea/KaptGradleModelorg/jetbrains/kotlin/kapt/idea/KaptGradleModel

日志:

2019-03-05 14:32:47,370 [d thread 7]   WARN - ect.sync.idea.ProjectSetUpTask - java.lang.NoClassDefFoundError: org/jetbrains/kotlin/kapt/idea/KaptGradleModel
at com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.populateKaptKotlinGeneratedSourceDir(AndroidGradleProjectResolver.java:359)
at com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.populateModuleContentRoots(AndroidGradleProjectResolver.java:250)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.jetbrains.plugins.gradle.service.project.TracedProjectResolverExtension.populateModuleContentRoots(TracedProjectResolverExtension.java:62)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:383)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$100(GradleProjectResolver.java:76)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:879)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:863)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:209)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:141)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:76)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda$resolveProjectInfo$0(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:58)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:45)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:100)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:163)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:149)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:573)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:678)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:736)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

2019-03-05 14:32:47,370 [d thread 7] WARN - ect.sync.idea.ProjectSetUpTask - org/jetbrains/kotlin/kapt/idea/KaptGradleModelorg/jetbrains/kotlin/kapt/idea/KaptGradleModel
2019-03-05 14:32:47,370 [d thread 7] INFO - e.project.sync.GradleSyncState - Gradle sync failed: org/jetbrains/kotlin/kapt/idea/KaptGradleModelorg/jetbrains/kotlin/kapt/idea/KaptGradleModel

当谷歌搜索这个错误时,人们提到要重新安装 Kotlin 插件。

但问题是:我从未安装过 Kotlin 插件。我不使用 Kotlin,我只使用 NDK 和 Java。

这一直工作得很好。

AndroidStudio 最近是否添加了对 Kotlin 插件的要求?我现在必须安装 Kotlin 吗?

更新

$ rm -rf ~/.gradle 解决方案没有帮助。

菜单选项使缓存无效/重新启动没有帮助。

A solution相关问题(升级到 Gradle 5.2.1)提供的内容没有帮助。

操作系统:Ubuntu LTS

AndroidStudio 版本:3.3.2

顶级gradle文件:

buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}
}

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

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

应用的gradle文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
lintOptions {
checkReleaseBuilds false
}
defaultConfig {
applicationId "com.steenriver.armor"
minSdkVersion 19
targetSdkVersion 28
versionCode 134
versionName "1.34"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
}
externalNativeBuild {
cmake {
cFlags "-DCP_USE_DOUBLES=0 -DCP_USE_CGTYPES=0"
cppFlags "-std=c++11 -DANDROID=1 -DPLAY=1 -DUSEES3=1 -DLOGTAG=armor -DCP_USE_DOUBLES=0 -DCP_USE_CGTYPES=0 -DAPPVER=$versionName"
arguments "-DCMAKE_VERBOSE_MAKEFILE=0", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DANDROID_ARM_MODE=arm"
}
}
}
buildTypes {
release {
minifyEnabled false
useProguard false
}
debug {
externalNativeBuild {
cmake {
cppFlags += "-DDEBUG"
}
}
}
}
externalNativeBuild {
cmake {
path '../../Android/jni/CMakeLists.txt'
}
}
}


dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
api 'com.android.support:support-v4:28.0.0'
api 'com.android.support:appcompat-v7:28.0.0'

api 'com.google.android.gms:play-services-auth:16.0.1'
api 'com.google.android.gms:play-services-nearby:16.0.0'
api 'com.google.android.gms:play-services-games:16.0.0'
api 'com.android.billingclient:billing:1.1'
}

最佳答案

我已经尝试了很多方法,但我能够消除此错误的唯一方法是启用 Kotlin 插件

settings

我觉得这很奇怪,因为:

  • 以前在没有 Kotlin 插件的情况下也能正常工作。
  • 我不会在任何地方使用任何 Kotlin 代码。仅 Java、C 和 C++。

我怀疑 Android Studio 最近在某个地方发现了对 Kotlin 的错误依赖。这很不幸。我不明白为什么需要这个插件。

关于AndroidStudio 无法同步 Gradle 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55013435/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com