简体   繁体   中英

Change source from 1.5 to 1.7 (Using the cocos command line tool)

I am trying to compile my android project using the following command line:

cocos deploy -p android -m release But i keep getting some errors saying the following:

error: diamond operator is not supported in -source 1.5

I tried manually modifying the individual files to fix the declaration so that it doesnt depend on 1.7, but after i did it many many errors appeared (the diamond operator one got fixed thought). So what i am thinking is that i need to make cocos compile it directly with 1.7 instead.

But i have looked for it everywhere and i can't find where to change that.

I am not using eclipse, nor android studio, i am using the terminal directly with the cocos commands.

Does anyone have any idea about where this is changed?

Update:

It has something to do with the java compiler, but still can't find where to change the javac settings:

[javac] /Users/LuisOscar/Documents/CocosProjects/Zombies/proj.android/src/net/nend/NendModule/NendIconModule.java:56: error: diamond operator is not supported in -source 1.5
[javac] private static HashMap<String, NendAdIconData> mNendAdIconHashMap = new HashMap<>();
[javac]                                                                                     ^
[javac]   (use -source 7 or higher to enable diamond operator)
[javac] /Users/LuisOscar/Documents/CocosProjects/Zombies/proj.android/src/net/nend/NendModule/NendModule.java:51: error: diamond operator is not supported in -source 1.5
[javac] private static HashMap<String, NendAdViewData> mNendAdHashMap = new HashMap<>();
[javac]                                                                                 ^
[javac] (use -source 7 or higher to enable diamond operator)

I found the location, For anyone else interested this is adjusted at:

Android/android-sdk-macosx/tools/ant/build.xml

It's shown under compilation options:

<property name="java.target" value="1.7" />
<property name="java.source" value="1.7" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM