Announcement

Collapse
No announcement yet.

Java 8 in ftc_app?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java 8 in ftc_app?

    Hello All,
    I am just wondering if it would be allowed for programmers to make use of the Jack Toolchain or the new Android Studio 3.0 Preview 1 with the ftc_app project in order to take advantage of new Java 8 features, such as Lambda Expression support. For anyone wondering, this would be important for my team because we have set up an event-and-handler-driven functionality implementation model which makes use of interfaces. In Java 7, implementing these interfaces inline is very tedious, as it not only creates messy-looking code, but also takes up a lot of document space and calls for lots of boilerplate; in Java 8 it would be far easier and faster. As far as I know, it should work; however, I have not seen it mentioned anywhere in the forums or game manual, so I was wondering if it was just disallowed or there is some other reason it wouldn't be possible. Thanks in advance!

    https://developer.android.com/studio...8-support.html
    http://tools.android.com/tech-docs/jackandjil

  • #2
    I see no reason why it wouldn't be allowed, however, you need to be running Android Nougat or higher to actually run Java 8 code.

    Comment


    • #3
      As a workaround, there is this library for lambdas: https://github.com/evant/gradle-retrolambda

      Alternatively, you could consider using Kotlin

      Comment


      • #4
        Originally posted by 4634 Programmer View Post
        I see no reason why it wouldn't be allowed, however, you need to be running Android Nougat or higher to actually run Java 8 code.
        Are we allowed to run Nougat for the competition?

        Comment


        • #5
          Originally posted by 4634 Programmer View Post
          I see no reason why it wouldn't be allowed, however, you need to be running Android Nougat or higher to actually run Java 8 code.
          I don't believe this is the case. We used Java 8 last year with the Moto G2 phones, which only run Marshmallow. We had to set targetSdkVersion to 23 and sourceCompatibility and targetCompatibility to JavaVersion.VERSION_1_8 in build.common.gradle, as well as add this inside defaultConfig:
          jackOptions {
          enabled true
          }

          Comment


          • #6
            Originally posted by GearTicks View Post

            I don't believe this is the case. We used Java 8 last year with the Moto G2 phones, which only run Marshmallow. We had to set targetSdkVersion to 23 and sourceCompatibility and targetCompatibility to JavaVersion.VERSION_1_8 in build.common.gradle, as well as add this inside defaultConfig:
            jackOptions {
            enabled true
            }
            Well, it looks like we're both half right. If you look at this table, you'll see that some Java 8 features require Nougat, (API24) and some don't

            Comment

            Working...
            X