blakgeek / cordova-plugin-flurryanalytics

Adds support for all that Flurry Analytics flavored goodness to your Cordova based apps
23 stars 29 forks source link

error building package ionic2 #26

Closed jullicer-geidi closed 7 years ago

jullicer-geidi commented 7 years ago

\plugin\flurry\FlurryAnalyticsPlugin.java:284: error: diamond operator is not supported in -source 1.6 Map<String, String> params = new HashMap<>(); ^ (use -source 7 or higher to enable diamond operator)

blakgeek commented 7 years ago

Change your compiler to use the modern java syntax.

On Wed, Sep 20, 2017 at 6:10 AM, jullicer-geidi notifications@github.com wrote:

\plugin\flurry\FlurryAnalyticsPlugin.java:284: error: diamond operator is not supported in -source 1.6 Map<String, String> params = new HashMap<>(); ^ (use -source 7 or higher to enable diamond operator)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blakgeek/cordova-plugin-flurryanalytics/issues/26, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyU3qsLPldtbOJTZzr6W4ZKgw5dD83vks5skOSegaJpZM4PdpCj .

-- Try TagIt4Me https://ti4.me/app, a free, community-driven mobile app that lets shoppers search, discover and share the location of nearby products, prices and deals.

Robertbaelde commented 7 years ago

Got the same error. Using Java 1.8. What is the minimum version needed?

blakgeek commented 7 years ago

@Robertbaelde Make sure you're not only using running 1.8 but also that you have the -source flag set to 7 or higher. The source flag tells the compiler the version of the syntax to enforce regardless of the actual version of java being used.

Robertbaelde commented 7 years ago

@blakgeek Thanks for your really quick reply! Tried that allready but got the following error back: Error: The platform "8" does not appear to have been added to this project.

blakgeek commented 7 years ago

I'm not sure how you tried to set the value. Look at SO link https://stackoverflow.com/questions/29386152/override-java-version-when-building-a-cordova-project-with-gradle

You need to override it in your build-extras.gradle like this

ext.postBuildExtras = {
    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }
}

Be aware this file will be lost if you remove the android platform. It's probably a good idea to keep a copy someplace other than in the platform/android directory. I have a hook that copies it from my project root into the platform directory. https://gist.github.com/blakgeek/f70f57910608764c65fd97abcacb63f7