Switched to build 2020.3635: build errors

Hi all,
I just switched to the latest build 2020.3635 of Solar2D (coming from 2020.3627).
The build worked for Android with Version 2020.3627 but with the newest version I receive a build error.
It seems to be related to my PlugIn which includes a corona.gradle.
Was there a change in the build procedure for Android maybe the handling of above file ?

ERROR: configuring 'plugin.paybluecode' failed!
                
                FAILURE: Build failed with an exception.
                
                * Where:
                Build file '/private/var/folders/jt/q0ctmttx77nfprt1_km63md40000gn/T/CLtmp3CCiQb/template/app/build.gradle.kts' line: 303
                
                * What went wrong:
                A problem occurred evaluating script.
                > No signature of method: corona_4k0dhe31x5kahxnf4g06x3r4m.android() is applicable for argument types: (corona_4k0dhe31x5kahxnf4g06x3r4m$_run_closure2) values: [corona_4k0dhe31x5kahxnf4g06x3r4m$_run_closure2@6ad76a23]
                
                * 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
                
                BUILD FAILED in 30s

can you post contents of your corona.gradle?

Sure, this is the content of the corona.build file which is included into the tgz file of the plugin:

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

def VersionBlueCodeSDK = '5.2.15'

repositories {
  maven {
      url "https://api.bitbucket.org/2.0/repositories/bluecodemobilesdk/bluecode-android-sdk/src/releases"
      credentials {
        username REPOSITORY_USERNAME
        password REPOSITORY_PASSWORD
      }
      authentication {
          basic(BasicAuthentication)
      }
  }
}

android {
    buildFeatures {
        dataBinding = true
    }
}

dependencies {

implementation "androidx.appcompat:appcompat:1.2.0-alpha03"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.percentlayout:percentlayout:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation 'androidx.multidex:multidex:2.0.0'

implementation "at.bluecode.sdk:ui:$VersionBlueCodeSDK"
implementation "at.bluecode.sdk:token:$VersionBlueCodeSDK"

// Kotlin Standard Library
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71"

// kotlin reflection
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.71"

}

and the file directory:
Bildschirmfoto 2021-01-26 um 18.30.18

Oh wow. This is rather intense. What version it was working on?

It worked with build 3627.
But I have to admit, I patched that version regarding the gradle-wrapper. I changed it towards
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

I checked with the latest version, there is already gradle 6.5 set. Therefore, I guess something maybe changed within the build cycle regarding including plugins that have their own corona.build file.

I guess, I found the mismatch:

I changed the following lines in build.gradle.kts in /Applications/Corona-3636/Native/Corona/android/resource/android-template/template and made a new android-template.zip file. Now it is working again. So I guess the problem lied in the ‘older’ version of the plugins:

classpath(kotlin("gradle-plugin", version = "1.4.21"))
classpath("com.android.tools.build:gradle:4.1.0")

@vlads maybe you can add those changes to one of the next builds, I guess there is little impact to existing builds when those plugins will be moved to newer versions. But decision is on your end.

Thank you for supporting.

Hey… So, I would love to do that but I can’t. I would recommend to modify your local /Native/Corona/android/resource/android-template.zip file to match that version of Android Gradle plugin.
Short explainer: gradle plugin switched to new NDK starting with 4.0 and it is not backwards compatible with what we are using now. For some reason new NDK produces errors in core Lua code and it is something I am investigating. But this is not a top priority for me at the moment. I would definitely migrate to newer Android plugin for other reasons. For now, a good workaround is to modify your template in place.

TL;DR: soon, but not now.

1 Like

Ok, thank you, that is fine. Work-around works, that is suffient.

A brief explainer:

When Corona builds for Android, it uses a template. This template is located under <Corona-Program-Location>/Native/Corona/android/resource named android-template.zip.
Take a look into the zip-file. There is also a file for gradle that defines the build process: build.gradle.kts.
There I adjusted the versions of plugin-ins that my plugin-in code requires.

If you change things, remember not to zip the directory but only both subfolders templateand sdk.

Quick hint: you can use 7zip browser to open the archive, press F4 on the selected file, edit it carefully and it would replace it inside the archive for you.

1 Like