非常令人困惑的Java.lang.RuntimeException:java.io.FileNotFoundException:

时间:2019-08-11 10:36:28

标签: java android android-studio gradle runtime-error

我已经从旧的硬盘切换到了固态硬盘,并且还升级了操作系统。我保存了我的项目的副本并下载了Android Studio,并认为它可以顺利运行。但我得到

    java.lang.RuntimeException: java.io.FileNotFoundException: 
    C:\Users\Gotta\AndroidStudioProjects\BrandShopping\app\build
    \intermediates\istant_run_split_apk_resources\debug
    \instantRunSplitApkResourcesDebug\out\slice_8\resources_ap

它也说:

   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.

但是当我尝试--scan时,它说'''此构建中使用了过时的Gradle功能,使其与Gradle 6.0不兼容。'''

但是当我尝试运行该应用程序时,它说:

    * What went wrong:
     Execution failed for task 
    ':app:transformDexWithInstantRunSlicesApkForDebug'.
     java.lang.RuntimeException: java.io.FileNotFoundException: 
    C:\Users\Gotta\AndroidStudioProjects\BrandShopping\app\build\
    intermediates\instant_run_split_apk_resources\debug\
    instantRunSplitApkResourcesDebug\out\slice_2\resources_ap

    * 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

但是就像我之前说的,构建成功

我尝试了不同的方法。我已使缓存无效并重新启动,但无济于事,我也尝试过在互联网上搜索可能的后遗症,但我找不到任何东西。

在我的Gradle.project中:

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

    buildscript {
repositories {
    google()
    jcenter()

}

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath 'com.google.gms:google-services:4.2.0'
    // 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.app中:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.brandshopping.brandshopping"
        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 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'com.google.gms:google-services:4.2.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.facebook.android:facebook-login:[5,6)'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
}
apply plugin: 'com.google.gms.google-services'

任何帮助都将不胜感激。

2 个答案:

答案 0 :(得分:1)

使用此设置,它对我有用

Settings-> Build-> Instant Run和'unselect'启用即时运行。

答案 1 :(得分:0)

只需从设置中取消选择“即时运行”即可,然后取消选择即时运行。

相关问题