Outsystems 项目无法编译cordova 插件,因为未找到ID 为“kotlin-android”的插件

问题描述

作为 Cordova 插件,该项目可以运行,但将其导入 Outsystems 时无法编译。

我在 kotlinbuild-extras.gradleconfig.xml 中指定时未找到

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" />

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)