首页 > 解决方案 > 每次遇到 RuntimeException、TransformException、ArgumentException 时,我都需要重建项目

问题描述

每次遇到 RuntimeException、TransformException、ArgumentException 时,我都需要重建项目。我认为问题出在 Gradle 文件中。

异常:RuntimeException:com.android.build.api.transform.TransformException:java.lang.IllegalArgumentException

  apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        multiDexEnabled true
        applicationId "com.example.domin.zooapp"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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.squareup.retrofit2:retrofit:2.4.0'
    implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.4.0'
    implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.10.0'
    implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
    implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.1'
    implementation group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.9.0'

    compileOnly 'org.projectlombok:lombok:1.18.4'
    annotationProcessor 'org.projectlombok:lombok:1.18.4'

    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.maps:google-maps-services:0.2.5'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
}

我会感谢你的帮助

标签: androidandroid-studio

解决方案


删除 c\users\username\ .gradle .android 和 .androidstudio 文件夹对我有用


推荐阅读