diamond operator is not supported

This question already has an answer here:

  • How to set -source 1.7 in Android Studio and Gradle 8 answers

  • Android needs java source compliance 5.0 or 6.0 (Java5/6). Java7 is not supported out of the box. The're articles describing hacks on how to use some of java7 features: http://www.informit.com/articles/article.aspx?p=1966024.

    Also see Java 7 language features with Android, Does Android plan to support Java7?, Can the Android SDK work with JDK 1.7?.


    API 19 KitKat Diamonds are now allowed. Below are Gradle edits needed to implement for Android Studio. Also make sure you are using JDK 1.7 and Gradle plugin later than 0.6.1

    android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"
    
    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
    }
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    }
    

    Android doesn't support 1.7 compilation level at this moment. So, you can't use diamond operator. You could fix this for java application by changing JRE to 1.7, but won't work with Android.

    链接地址: http://www.djcxy.com/p/17968.html

    上一篇: Android SDK可以使用JDK 1.7吗?

    下一篇: 钻石操作员不受支持