gpt4 book ai didi

android-studio - Android Studio 无法同步和构建新旧 kotlin 项目

转载 作者:行者123 更新时间:2023-12-03 05:25:56 29 4
gpt4 key购买 nike

当我在 Android Studio 中创建一个新项目并加载旧项目时,我得到了这个:

java.lang.NoClassDefFoundError: org/gradle/internal/impldep/com/google/common/collect/Lists
java.lang.ClassNotFoundException:org.gradle.internal.impldep.com.google.common.collect.Lists
错误:无法加载类“org.gradle.internal.impldep.com.google.common.collect.Lists”。
此意外错误的可能原因包括:
Gradle 的依赖缓存可能已损坏(这有时会在网络连接超时后发生。)
重新下载依赖并同步项目(需要网络)

Gradle 构建过程(守护进程)的状态可能已损坏

现在我完全坚持这一点。

1,    I downloaded studio again and installed to an other drive, the probleme still exists.  
2, I deleted all of my Android Studios from my computer, I downloaded and installed again. Started a new kotlin project, the same error happened.
3, invalidate/restart not fixed
4, redownload dependencies not fixed
5, update gradle not fixed
6, flutter plugin disabled, not fixed

我也将旧的 Android Studio 用于颤振/飞镖和 kotlin。看起来我无法再构建原生应用程序/kotlin。

我的 gradle 包装器

distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
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
}

构建 gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

defaultConfig {
applicationId "hu.lacas.myapplication"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

应用程序构建 gradle

有任何解决这个问题的方法吗?

谢谢

最佳答案

哈哈。我找到了一个旧项目!
我从中复制了这个字符串:

dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71"
}


distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

最后同步,构建!!!

新的 Android Studio 中的某些东西非常糟糕,因为即使我创建了一个新项目 ,我也会遇到很多错误/同步失败

关于android-studio - Android Studio 无法同步和构建新旧 kotlin 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61208567/

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