When I try to run the osmdroid with Android Studio 3.0, there is an error:
Error: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.
It seems a compile problem of the new version of Android Studio, but the most solutions online is to change property of varients.each to varients.all, but there is no such code in my project.
It is like this:
android.applicationVariants.all { variant ->
if (variant.getBuildType().name == "debug") {
task "configDevice2${variant.name.capitalize()}" (type: Exec){
dependsOn variant.install
group = 'nameofyourtaskgroup'
description = 'Describe your task here.'
def adb = android.getAdbExe().toString()
def mypermission = 'android.permission.WRITE_EXTERNAL_STORAGE '
commandLine "$adb shell pm grant ${variant.applicationId} $mypermission".split(' ')
}
variant.testVariant.connectedInstrumentTest.dependsOn "configDevice2${variant.name.capitalize()}"
} }
I really need your help, I am new to Android, and I have tried my best.