chymtt / ReactNativeDropdownAndroid

A simple wrapper for Android's Spinner in react-native
MIT License
62 stars 22 forks source link

react-native run-android build fails #9

Closed whomba closed 8 years ago

whomba commented 8 years ago

I've made the changes to the appropriate files you mention in your instructions. When I try to run: react-native run-android I get the following errors:

myProject/node_modules/react-native-dropdown-android/android/src/main/java/com/chymtt/reactnativedropdown/Dropdown.java:31: illegal start of type
        ArrayList<String> spinnerArray = new ArrayList<>();
                                                       ^
myProject/node_modules/react-native-dropdown-android/android/src/main/java/com/chymtt/reactnativedropdown/Dropdown.java:53: illegal start of type
        ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(mContext,
                                                                    ^
myProject/node_modules/react-native-dropdown-android/android/src/main/java/com/chymtt/reactnativedropdown/DropdownPackage.java:16: illegal start of type
        return new ArrayList<>();
                             ^
3 errors
:ReactNativeDropdownAndroid:compileReleaseJavaWithJavac FAILED

Not sure if this a known issue, however I can't do any work without changing to

new ArrayList<String>()

for the first two, and for the third:

return new ArrayList<NativeModule>();

Any thoughts on an alternative solution?

chymtt commented 8 years ago

Are you using Java 1.6 or below? Since the generic <> syntax is only available to Java 1.7+. I'll make the appropriate changes to the component so it can run on Java 1.6 and below. Anyway I still recommend you moving to Java 1.7+ for better compatibility