Closed ghost closed 8 years ago
OK, a somewhat stupid question for you, as I couldn't find an answer anywhere else. before I do this, will it mean that my app will no longer work on android devices pre KitKat, as Java 7 support was introduced in KitKat ? I tried adding this to my build.gradle, and the resulting build still runs fine on my 4.2 device, will the fdroid build do so too ? Second stupid question, how do I find out where in my code I used Java 7 features, so I can change it to be Java 6 compatible ?
Thanks.
I am actually not sure, iirc compiling with different java option wont make an impact on the bytecode/apk, because android's minsdk is honored. F-Droid should have the latest version by now (or in a couple of hours), since I applied the patches on our side. You can check if the resulting apk works on <4.2 .
The issue itself was in
:app:compileReleaseJava/home/krt/src/fdroiddata/build/jonas.tool.saveForOffline/app/src/main/java/jonas/tool/saveForOffline/DisplayAdapter.java:205: error: strings in switch are not supported in -source 1.6
switch ((String) imageView.getTag()) {
^
(use -source 7 or higher to enable strings in switch)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILED
I guess if you use JavaVersion.VERSION_1_6 instead, you will see this error even if you have jdk7 or jdk8 setup as default.
OK, tried the fdroid build and everything seems to work, so I've committed this change. Closing this. Thanks for all the effort going into maintaining F-Droid!
Uhm, compileOptions are meant to go in to the android section
@krt16s Thanks fixed. I guess these issues are happening because I'm (partially) writing this on my tablet with AIDE, which uses a nonstandard gradle, and as such also ignores things like this (seems to force Java 1.7 even without this in build.gradle, so that's why I'm not seeing these errors.)
Java1.7: If you only have java1.7, this happens on my machine, too. But when you have all java versions installed, gradle/Android default to 1.6.
Yes, that's true for desktop - the thing is that in my case, I'm writing my code and compiling on my Android device itself, so there's no Java 6 or Java 7 as such. And since the compiler / build system / gradle I'm using is semi-broken and non-standard, it happily compiles bad code. That's why you get errors and I don't.
Will fix the new issue you opened though, thanks :-)
You should force java 1.7+ by adding the following lines to build.gradle, since 1.6 is not compatible with your java source: