0

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.

Fency
  • 1
  • 3

2 Answers2

0

osmdroid uses gradle fury as a build helper. Unfortunately, google changed their apis which breaks things. This happens frequently and it just hasn't been updated yet. Details for the fix is here:

https://github.com/gradle-fury/gradle-fury/issues/54

I've opened a issue at osmdroid so that this can be tracked as well

https://github.com/osmdroid/osmdroid/issues/797

spy
  • 3,199
  • 1
  • 18
  • 26
  • Thanks a lot for giving me a new thought, I will have a try. – Fency Dec 04 '17 at 08:24
  • Thanks again! This error was solved just 2 days ago, so I redownloaded the newest version of osmdroid, finally it worked! I can run the project! Thank you very much! – Fency Dec 04 '17 at 09:13
0

Finally, I just redownloaded the newest version of osmdroid, because some masters have solved the problem, I have to say thank you to the masters! Even though, there would be a little errors, it can be fixed easily.

Fency
  • 1
  • 3