none
Android build does not work with Java 9.0.1 - anyone knows how to fix it? RRS feed

  • Question

  • Hello,

    I am trying to build an Android application using Microsoft Visual Studio Community 2017 with support for Android. This application consists of 5 native C++ static libraries and 2 Java projects, one of the latter being the main project of the solution. My Android NDK is android-ndk-r13b. The build variables are:

    1>ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
    1>ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Apps\apache-ant-1.9.3
    1>JAVA_HOME=
    1>NDK_ROOT=C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b
    1>ANDROID_NDK_HOME=C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b
    1>

    I can build all the native C++ libraries, but an attempt to build the Java projects fails with the message

    Could not determine java version from '9.0.1'.

    Digging around, I was able to trace this problem to Gradle. The Gradle plugin is

    gradle-experimental:0.4.0

    and this version requires use of Gradle 2.8. But Gradle 2.8 cannot run on Java 9. A newer version of Gradle is necessary (4.3.1 AFAIK) for that.

    Unfortunately, the plugin seems to require Gradle 2.8 and no other. If I play around with the configs and try to force use of a newer Gradle, the build fails with the complaint that Gradle 2.8 is needed.

    My colleagues use Java 8 and they are fine so far, but I would really like to know if there are ways how to get this running on newer Java versions. Support for Java 8 is to be discontinued in September 2018.

     


    • Moved by 宝宝徐 Tuesday, November 21, 2017 5:36 AM
    Wednesday, November 15, 2017 4:34 PM

All replies

  • Hi,

    Welcome to MSDN forum.

    Please open a new thread in Gradle forum or stackoverflow to talk about the problem. if you have problems about visual studio IDE, please feel free to let me know.

    Best regards,

    Joyce


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 16, 2017 6:08 AM
  • Hi Joyce,

    I only ever installed tools using the MSVC++ Installer. The problem is not in Gradle per se, but in the corresponding MSVC++ tools and in the way they are configured by default.

    MSVC++ is intended to support Android development and its current configuration, as provided by Microsoft, cannot deal with Java 9.0.1. So I believe that my question is perfectly suitable here. Gradle developers cannot do anything at all about the way how Microsoft configures the IDE. This is up to Microsoft to figure out.

    Regards

    Marian

    Thursday, November 16, 2017 12:28 PM
  • >>Could not determine java version from '9.0.1'.

    Above error could be solved by upgrading to Gradle 4.3  right? 

    >>Unfortunately, the plugin seems to require Gradle 2.8

    Then you probably need switch the Plugin version to 0.11.0(Experimental Plugin User Guide), if you don't want to use Gradle 2.8 which seems not compatible with Jave 9.0.1

     

    Regards, 

    Fletcher 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Friday, November 17, 2017 9:30 AM
    Friday, November 17, 2017 9:29 AM