Jenkins上的Ionic 3 + Cordova应用程序编译问题

在Jenkins 2.164.1。中编译Ionic 3应用程序时遇到问题。适用于Android

CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:javaPreCompileRelease
:compileReleaseJavaWithJavac/var/lib/jenkins/workspace/dev/AppMovilDocenteCas-android/platforms/android/src/com/customtabplugin/ChromeCustomTabplugin.java:46: error: cannot find symbol final Context context = this.cordova.getcontext();

symbol:   method getcontext()
location: variable cordova of type CordovaInterface
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

我已经阅读了有关sourceCompatibilitytargetcompatibility的类似问题。可以在build.gradle文件中更改这些属性,但是由于我在CI环境中并且生成了build.grade,因此无法直接对其进行修改。

我尝试过的事情:

  • 使用Cordova挂钩build-extra.gradle处理after_prepare文件。我的build-extra.gradle文件看起来像这样

build-extra.gradle

ext.postBuildExtras = {
  android {
    defaultConfig {
      jackOptions {
        enabled true
      }
    }

    compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetcompatibility JavaVersion.VERSION_1_8
    }
  }
}

当前我在詹金斯(Jenkins)中使用此工具

  • Gradle v3.5
  • Android Build Tools v25.0.3

我的应用程序使用:

  • 科尔多瓦v7.0.1
  • 离子v3.9.2
  • Cordova插件:
<plugin name="cordova-plugin-app-version" spec="^0.1.9" />
<plugin name="cordova-plugin-customurlscheme" spec="^4.3.0" />
<plugin name="cordova-plugin-device" spec="^1.1.7" />
<plugin name="cordova-plugin-geolocation" spec="^2.4.3" />
<plugin name="cordova-plugin-network-information" spec="^1.3.4" />
<plugin name="cordova-plugin-safariviewcontroller" spec="^1.5.4" />
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-sqlite-storage" spec="^2.6.0" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="onesignal-cordova-plugin" spec="^2.6.0" />

您以前是否遇到过类似的问题?任何见解都可能有用! 谢谢!

h520zh 回答:Jenkins上的Ionic 3 + Cordova应用程序编译问题

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3159403.html

大家都在问