Monday, November 27, 2023

How I fixed the Android Studio current target and jvm target compatibility error

I encountered the following compilation error in Android Studio of one of my Android project about current target JVM compatibility (or incompatibility), as shown in the screenshot message listing below:

 

Execution failed for task ':app:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

I managed to fix the problem by ensuring the source and target are compatible, i.e. having the same Java version.

To fix the issue:

  1. In Android Studio, select File | Project Structure.

    The Project Structure dialog box appears.


  2. Click Gradle Settings.

    The Gradle dialog box appears.


  3. In the Use Gradle from combo box, choose 'gradle-wrapper.properties' file.

  4. In the Gradle JDK combo box, choose jbr-17 JetBrains Runtime version 17.

  5. Click OK to close all dialog boxes.

  6. In Android Studio, open the app's build.gradle file in the editor.


  7. Within the android construct, add in the compileOptions as shown in the listing below.

android {
    compileSdk 33

// ...etc...

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
}

From this point on, compiling the app should not throw upany  JVM target compatibility errors.

Monday, November 13, 2023

Using Koordinat2 webapp to convert between SVY21 and geographical coordinates

This is a follow up to the original post https://dominoc925.blogspot.com/2021/02/koordinat2-webapp-for-geo-coordinates.html, which describes a generic coordinate conversion steps. This post shows how to specifically use the Koordinat2 webapp https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html to convert from WGS 84 latitude, longitude coordinates to SVY21 projected easting and northing coordinates, and vice versa.

Select the WGS 84 lat, lon as the source coordinate system

  1. Using a modern browser, open the url https://dominoc925-pages.appspot.com/webapp/koordinat2/default.html.

    The Koordinat2 web app appears in the browser.


  2. In the Input Coordinates card, click the gears icon labeled 1 in the screen above.

    The Select Source Coordinate System dialog appears.


  3. In the Search field, type in a partial string for the WGS84 latitude, longitude system, e.g. "4326" or "WGS 84".

    A list of matches appear.



  4. Click the WGS 84 list item.

    The WGS 84 geographic coordinate system is selected.


Select the destination SVY21 coordinate system

  1. In the Output Coordinates card, click the gear icon (labeled 2 in the screen below).




     

    The Select Destination Coordinate System dialog appears.


  2.  In the Search field, type in a partial string for SVY21, e.g. "3414" or "SVY21".

    A list of matching coordinate systems appears.


  3. Click the SVY21 / Singapore TM list item.

    The destination coordinate system is selected.


Performing coordinate conversions from latitude, longitude to SVY21

  1. In the Input Coordinates card, enter the Longitude and Latitude values.

    The Longitude/Latitude coordinates are dynamically converted and displayed in the Output Coordinates card.

  2. Optional. If you wish to see the location of the coordinates on the map, click the marker icon as shown below.



    The location is marked by a marker on the map.


Performing coordinate conversion from SVY21 to WGS84 latitude, longitude

If you wish to perform the reverse conversion, simply repeat the previous steps but reverse the coordinate system selections.