gpt4 book ai didi

android - IOException 无法删除路径

转载 作者:行者123 更新时间:2023-12-04 16:03:40 31 4
gpt4 key购买 nike

我在我的一个项目中遇到了这个错误。

FAILURE: Build failed with an exception.

  • What went wrong:

    Execution failed for task ':app:transformClassesWithDesugarForDevServerDebug'. com.android.build.api.transform.TransformException: java.io.IOException: Could not delete path 'D:\Android\Projects\uralenergo\app\build\intermediates\transforms\desugar\devServer\debug\1.jar'.

  • 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

    BUILD FAILED in 9s



我经常在这个项目上工作,当我尝试在手机上运行我的应用程序时,我厌倦了在 40% 的情况下看到这个错误。

如果我执行 Rebuild Project,错误就会消失并编译应用程序。
但是在构建应用程序2-3次后,再次出现此错误。

这个项目很大,我不能把时间浪费在重建项目上。
我试图手动删除此文件夹。但这对我没有帮助。

build.gradle 文件:
buildscript {
ext.kotlin_version = '1.2.3-1'
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "io.realm:realm-gradle-plugin:3.7.1"
classpath 'io.fabric.tools:gradle:1.24.4'
classpath 'com.google.gms:google-services:3.2.0'
}
}

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

apply plugin: 'idea'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
google()
}

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
flavorDimensions "versionCode"
defaultConfig {
applicationId "com.softjet.uralenergo"
minSdkVersion 16
targetSdkVersion 27
versionCode 122
versionName "1.1.5"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

multiDexEnabled true
}


dexOptions {
javaMaxHeapSize "4g"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
exclude 'META-INF/rxjava.properties'
}

signingConfigs {
debug {
storeFile file("keys\\debug_key.jks")
storePassword "xxx"
keyAlias "xxx"
keyPassword "xxx"
}
release {
def keystorePropertiesFile = file("keys\\release.properties")
if (keystorePropertiesFile.exists()) {
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
} else {
return null
}
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('D:/Android/Projects/uralenergo/keystore/release_key.jks')
storePassword 'xxx'
}
}

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

productFlavors {
devServer {
applicationIdSuffix ".debug"
}
prodServer {
applicationIdSuffix ""
}
}

configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:24.1-jre'
force 'com.google.guava:guava-gwt:24.1-jre'
}
}
}

def renameAPK(variant) {
variant.outputs.each { output ->
def file = output.packageApplication.outputFile
def lastSuffix = getVersionNameSuffix(variant)
def fileName = rootProject.name + " v" + variant.versionName + lastSuffix + ".apk"
output.packageApplication.outputFile = new File(file.parent, fileName)
}
}

static def getVersionNameSuffix(variant) {
def flavorName = variant.flavorName
def buildType = variant.buildType.name

if (buildType == "debug") {
if (flavorName == "prodServer")
return "a"
if (flavorName == "devServer")
return "-debug"
}
if (buildType == "release") {
if (flavorName == "prodServer")
return "-release"
if (flavorName == "devServer")
return "-debug-signed"
}
throw new RuntimeException("Unsupported variant: build type=" + buildType + " and flavorName=" + flavorName)
}

task assembleDevServerDebugAndProdServerRelease {
group = 'custom_assemble'
dependsOn 'assembleDevServerDebug'
dependsOn 'assembleProdServerRelease'
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
}
}

ext {
supportLibraryVersion = "27.1.1"
googlePlayServicesVersion = "12.0.1"
daggerVersion = "2.11"
okhttpVersion = "3.5.0"
retrofitVersion = "2.1.0"
butterKnifeVersion = "8.8.1"
permissionsDispatcherVersion = "2.4.0"
glideVersion = "4.1.1"
materialDialogsVersion = "0.9.4.7"
flipboardBottomSheetVersion = "1.5.3"
junitVersion = "4.12"
}

dependencies {

//Jars
implementation fileTree(include: ['*.jar'], dir: 'libs')

//Support Libs
implementation "com.android.support:support-v4:$supportLibraryVersion"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:gridlayout-v7:$supportLibraryVersion"
implementation 'com.android.support:multidex:1.0.3'

//Google
implementation "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
implementation "com.google.android.gms:play-services-maps:$googlePlayServicesVersion"

//Firebase
implementation "com.google.firebase:firebase-core:$googlePlayServicesVersion"
implementation "com.google.firebase:firebase-messaging:$googlePlayServicesVersion"

//Dagger2
implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"

//Rx
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.0'

//Ok Http
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"

//Retrofit2
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation("com.squareup.retrofit2:converter-simplexml:$retrofitVersion") {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}

// //Pushbots

// implementation 'com.pushbots:pushbots-lib:3.0.1@aar'

//Butter Knife
implementation "com.jakewharton:butterknife:$butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"

//Realm
annotationProcessor 'dk.ilios:realmfieldnameshelper:1.1.1'

//Permissions Dispatcher
implementation "com.github.hotchemi:permissionsdispatcher:$permissionsDispatcherVersion"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissionsDispatcherVersion"

//Crashlytics
implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true
}

//Picasso
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'

//Glide
implementation "com.github.bumptech.glide:glide:$glideVersion"
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"

//GestureImageView
implementation 'com.alexvasilkov:gesture-views:2.4.1'

//Material Design Additional Libs

//--Dialogs
implementation "com.afollestad.material-dialogs:core:$materialDialogsVersion"
implementation "com.afollestad.material-dialogs:commons:$materialDialogsVersion"

//--Better Spinner
implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'

//--Search View
implementation 'com.miguelcatalan:materialsearchview:1.4.0'

//--Help Screen
implementation 'com.github.apl-devs:appintro:v4.2.2'

//Shape ImageView
implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'

//Circular Image View
implementation 'com.mikhaellopez:circularimageview:3.0.2'

//Animations
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.2@aar'

//Input Mask
implementation 'com.redmadrobot:inputmask:2.2.1'

//Autofit Text View
implementation 'me.grantland:autofittextview:0.2.1'

//View Pager Indicator
implementation 'com.romandanylyk:pageindicatorview:0.1.2@aar'

//Expandable Layout
implementation 'com.github.aakira:expandable-layout:1.6.0@aar'

//Multi Slider
implementation 'io.apptik.widget:multislider:1.3'

//Pdf Viewer
implementation 'com.github.barteksc:android-pdf-viewer:2.5.1'

//Barcode (QR) scanner
implementation 'me.dm7.barcodescanner:zxing:1.9.4'

//Bottom Sheet
implementation "com.flipboard:bottomsheet-core:$flipboardBottomSheetVersion"
implementation "com.flipboard:bottomsheet-commons:$flipboardBottomSheetVersion"

//Metricas
implementation 'com.yandex.android:mobmetricalib:2.76'

//Unit Tests
testImplementation "junit:junit:$junitVersion"
implementation "junit:junit:$junitVersion"

//Android Tests
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'jsr305'
})
}

//must be on the bottom
apply plugin: 'com.google.gms.google-services'

最佳答案

发生这种情况是由于多种原因,例如当您升级操作系统或更改项目路径或再次下载工作室时,需要删除构建文件夹中的先前文件。因此,在这种情况下,启动 Android studio as --> 以管理员身份运行 .

然后右键单击工作室项目中的构建文件夹,然后单击在资源管理器中显示。 现在删除构建文件夹 .如果需要管理员权限,请单击复选框并将其删除。现在重建项目并运行项目。

关于android - IOException 无法删除路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49731210/

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