Android Studio3.0 升级后所报的一些错误

2018-02-02  本文已影响0人  不会说话的李先森

1.Error:(130, 0) Cannot set the value of read-only property ‘outputFile’ for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl

解决方案


简单粗暴,直接贴代码

applicationVariants.all { variant ->

variant.outputs.all { output ->

def fileName ="appname_v${variant.versionName}_release_${variant.flavorName}.apk"

        if(variant.buildType.isDebuggable()){

fileName ="appname_v${variant.versionName}_debug_${variant.flavorName}.apk"

        }

outputFileName = fileName

}

}

2.在安卓模拟器之后,有一个深坑

Android Studio3.0 Error:Execution failed for task ':app:javaPreCompileDebug' 错误

解决方案

在app的build.gradle(modile:app)中找到

android {

    ...

    defaultConfig {

        ...

        //添加如下配置就OK了

        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }

    }

    ...

}

持续更新中,愿我们所走的深坑越来越少

上一篇下一篇

猜你喜欢

热点阅读