gpt4 book ai didi

android - 进程无法访问该文件,因为该文件正在被另一个进程使用 [Android] [Gradle]

转载 作者:行者123 更新时间:2023-12-02 16:35:45 26 4
gpt4 key购买 nike

每当尝试运行 flutter 应用程序时,我都会遇到此错误。

* 出了什么问题:
任务“:app:transformResourcesWithMergeJavaResForDebug”执行失败。
java.nio.file.FileSystemException: D:\Projects\buisnesscard\build\app\intermediates\transforms\mergeJavaRes\debug\0.jar: 该进程无法访问该文件,因为该文件正在被另一个进程使用。

我尝试添加:

包装选项{
排除“META-INF/DEPENDENCIES.txt”
排除“META-INF/通知”
排除“META-INF/NOTICE.txt”
排除“META-INF/许可证”
排除“META-INF/LICENSE.txt”
}

到我的构建gradle文件并重新启动android studio,但错误仍然发生。

我的/app/build.gradle 看起来像这样:

`

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28

lintOptions {
disable 'InvalidPackage'
}

packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.seandiacono.buisnesscard"
minSdkVersion 21
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:17.0.0'
}

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

`

最佳答案

对我来说有效的是关闭 Android Studio,转到文件资源管理器中的我的工作区并删除 {project}/app/build。然后重新打开 Android Studio。

关于android - 进程无法访问该文件,因为该文件正在被另一个进程使用 [Android] [Gradle],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57009683/

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