1

As a Cordova plugin the project works, but when importing it into Outsystems it doesn't compile.

kotlin is not found while I specified it in build-extras.gradle, config.xml and plugin.xml:

[2020-12-22T16:12:21.860Z] [ERROR] [Build] * What went wrong:
[2020-12-22T16:12:21.860Z] [ERROR] [Build] A problem occurred evaluating project ':app'.
[2020-12-22T16:12:21.860Z] [ERROR] [Build] > Plugin with id 'kotlin-android' not found.
[2020-12-22T16:12:21.860Z] [ERROR] [Build] * Try:
[2020-12-22T16:12:21.860Z] [ERROR] [Build] Run with --stacktrace
[2020-12-22T16:12:21.860Z] [ERROR] [Build]  option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan
[2020-12-22T16:12:21.860Z] [ERROR] [Build]  to get full insights.
[2020-12-22T16:12:21.860Z] [ERROR] [Build] * Get more help at https://help.gradle.org
[2020-12-22T16:12:21.860Z] [ERROR] [Build] BUILD FAILED in 29s
[2020-12-22T16:12:21.860Z] [ERROR] [Build] Error: Unable to disable Gradle daemon
[2020-12-22T16:12:21.861Z] [ERROR] [Build] Build failed with the following error: An unexpected error has occurred while generating your application. Please try again. If the problem persists, contact OutSystems Support.

plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
        id="myplugin-rfid-plugin"
        version="0.1.0">

  <name>MyPluginName</name>

  <!-- android -->
  <platform name="android" kotlin="1.4.21">
  <apply-plugin>kotlin-android</apply-plugin>

  <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21" />
  <framework src="org.jetbrains.kotlin:kotlin-reflect:1.4.21" />

  <framework src="src/build-extras.gradle" custom="true" type="gradleReference" />

  </platform>

</plugin>

build-extras.gradle:

ext.cdvCompileSdkVersion = 28;

android {
    compileSdkVersion 28

    defaultConfig {
        
        ndk {
            abiFilters 'armeabi'
        }   
    }

    sourceSets {
        main.java {
            srcDirs += 'src/main/kotlin'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.*'], dir: 'libs')

    implementation "org.jetbrains.kotlin:kotlin-reflect:1.4.21"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21"
    implementation 'com.google.code.gson:gson:2.8.6'
}

ext.postBuildExtras = {
    apply plugin: 'kotlin-android'
}

config.xml:

<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinCodeStyle" value="official" />
<preference name="GradlePluginKotlinVersion" value="1.4.21" />
Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94

0 Answers0