Monaca Onsen UI Discord Chat Github Repo

Use -source 7 to allow strings in switch - android build fails




  • Configuration ‘compile’ in project ‘:’ is deprecated. Use ‘implementation’ instead.
    publishNonDefault is deprecated and has no effect anymore. All variants are now published.
    Download https://jcenter.bintray.com/com/onesignal/OneSignal/3.12.4/OneSignal-3.12.4.pom
    :preBuild UP-TO-DATE
    :CordovaLib:preBuild UP-TO-DATE
    :CordovaLib:preReleaseBuild UP-TO-DATE
    :CordovaLib:checkReleaseManifest
    :CordovaLib:processReleaseManifest
    :preReleaseBuild
    Download https://jcenter.bintray.com/com/onesignal/OneSignal/3.12.4/OneSignal-3.12.4.aar
    :CordovaLib:compileReleaseAidl
    :compileReleaseAidl
    :CordovaLib:packageReleaseRenderscript NO-SOURCE
    :compileReleaseRenderscript
    :checkReleaseManifest
    :generateReleaseBuildConfig
    :prepareLintJar
    :generateReleaseResValues
    :generateReleaseResources
    :CordovaLib:compileReleaseRenderscript
    :CordovaLib:generateReleaseResValues
    :CordovaLib:generateReleaseResources
    :CordovaLib:packageReleaseResources
    :mergeReleaseResources
    :createReleaseCompatibleScreenManifests
    :processReleaseManifest
    :splitsDiscoveryTaskRelease
    :CordovaLib:platformAttrExtractor
    :CordovaLib:generateReleaseBuildConfig
    :CordovaLib:prepareLintJar
    :CordovaLib:javaPreCompileRelease
    :CordovaLib:processReleaseJavaRes NO-SOURCE
    :compileReleaseNdk NO-SOURCE
    :mergeReleaseShaders
    :compileReleaseShaders
    :generateReleaseAssets
    :CordovaLib:mergeReleaseShaders
    :CordovaLib:compileReleaseShaders
    :CordovaLib:generateReleaseAssets
    :CordovaLib:mergeReleaseAssets
    :mergeReleaseAssets
    :mergeReleaseJniLibFolders
    :CordovaLib:compileReleaseNdk NO-SOURCE
    :CordovaLib:mergeReleaseJniLibFolders
    :CordovaLib:transformNativeLibsWithMergeJniLibsForRelease
    :CordovaLib:transformNativeLibsWithIntermediateJniLibsForRelease
    :processReleaseJavaRes NO-SOURCE
    :validateSigningRelease
    :CordovaLib:processReleaseResources
    :processReleaseResources
    :generateReleaseSources
    :CordovaLib:generateReleaseSources
    :CordovaLib:compileReleaseJavaWithJavac
    :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
    :javaPreCompileRelease
    :compileReleaseJavaWithJavac FAILED
    38 actionable tasks: 38 executed

    • postBuild -
      Build Error: Error: Sandbox Exec Error: [ 注意:一部の入力ファイルは非推奨のAPIを使用またはオーバーライドしています。
      注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。
      /private/tmp/monaca/5dfa2e0ae788853a5900a998/project/platforms/android/src/com/plugin/gcm/OneSignalPush.java:159: エラー: switch内の文字列は-source 1.6でサポートされていません
      switch(action) {
      ^
      (switch内の文字列を使用可能にするには、-source 7以降を使用してください)
      注意:一部の入力ファイルは非推奨のAPIを使用またはオーバーライドしています。
      注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。
      エラー1個

    FAILURE: Build failed with an exception.

    • What went wrong:
      Execution failed for task ‘:compileReleaseJavaWithJavac’.

    Compilation failed; see the compiler error output for details.

    • Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 14s
    Error: /private/tmp/monaca/5dfa2e0ae788853a5900a998/project/platforms/android/gradlew: Command failed with exit code 1 Error output:
    注意:一部の入力ファイルは非推奨のAPIを使用またはオーバーライドしています。
    注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。
    /private/tmp/monaca/5dfa2e0ae788853a5900a998/project/platforms/android/src/com/plugin/gcm/OneSignalPush.java:159: エラー: switch内の文字列は-source 1.6でサポートされていません
    switch(action) {
    ^
    (switch内の文字列を使用可能にするには、-source 7以降を使用してください)
    注意:一部の入力ファイルは非推奨のAPIを使用またはオーバーライドしています。
    注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。
    エラー1個

    FAILURE: Build failed with an exception.

    • What went wrong:
      Execution failed for task ‘:compileReleaseJavaWithJavac’.

    Compilation failed; see the compiler error output for details.

    • Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 14s


    Any idea how can this be fixed?


  • administrators

    This is caused by a plugin using Java features that aren’t supported by your Java version. It looks like you are using Java 6. Is this on Monaca’s remote build service? Remote builds use an recent enough version of Java that this shouldn’t be a problem, unless you have specifically configured to use Java 6.



  • Thanks @emccorson. Yes this is on Monaca’s remote build service via Localkit. I’m not sure there’s specified a version of Java set to be used while on remote build… how do I check this?


  • administrators

    Actually, more likely is that this is a problem with OneSignal than the Java version, since I’ve seen this error in other places.

    What’s the specific name of the plugin you are using?



  • Oh, okay. I’m using the plugin from “https://github.com/OneSignal/OneSignal-Cordova-SDK”, it is named as “onesignal-cordova-plugin”.

    What’re my options out from here? Any suggestions from the past encounters of this error?


  • administrators

    @shubhanan I think it is the same problem as here: https://community.onsen.io/topic/3833/urgent-error-when-build-for-release-of-an-ios-app

    See that link for a solution.



  • Thank you, @emccorson! The build succeeded once I set the version to 2.7.0.

    Hopefully OneSignal team figures this out in the near future!