My app is not acknowledging JDK 1.8. I'm trying to use a switch case with a string as the switch. Just using a basic example from JavaDocs Yes, I could switch to if/else statements but I'd rather not.
public String getTypeOfDayWithSwitchStatement(String dayOfWeekArg) {
String typeOfDay;
switch (dayOfWeekArg) {
case "Monday":
typeOfDay = "Start of work week";
break;
case "Tuesday":
case "Wednesday":
case "Thursday":
typeOfDay = "Midweek";
break;
case "Friday":
typeOfDay = "End of work week";
break;
case "Saturday":
case "Sunday":
typeOfDay = "Weekend";
break;
default:
throw new IllegalArgumentException("Invalid day of the week: " + dayOfWeekArg);
}
return typeOfDay;
}
I'm getting the error of Incompatible Types: byte, char, int, short
which would mean I'm using an old version of Java.. Which doesn't make sense as I have jdk1.8.0_11 installed.
Would this be an issue in my Gradle files?
apply plugin: 'com.android.application'
dependencies {
compile 'com.parse.bolts:bolts-android:1.1.2'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.android.support:support-v4:18.0.0'
}
android {
compileSdkVersion 15
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "name"
minSdkVersion 15
targetSdkVersion 15
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}