You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have built the repository for macOS on Intel-based systems and for Linux systems.
I have created the native files and .jar files as expected.
I ran the .jar file using your suggested command: java --class-path target/proj-2.1-SNAPSHOT.jar example/TransformPoints.java.
I need to use these .jar files in my Android project, which is based on Kotlin Compose. I have imported the "proj-2.1-SNAPSHOT.jar" file and can access its classes.
This .jar file produces the expected results when run in the terminal on my macOS laptop.
However, when I try to build the Android project to generate a debug APK, I encounter an error.
In Java, there is a file named "NativeResource.java" that contains a function called "libraryPath." This function imports a native file named "libproj-binding.dylib" (for macOS) or "libproj-binding.so" (for Linux).
The project builds without issues, but when I run the code to access the classes, I use the following function:
privatefuntransformPoints() {
try {
val transformPoints =TransformPoints.main(arrayOf("EPSG"))
val factory =Proj.getAuthorityFactory("EPSG")
val regops =Proj.getOperationFactory(null)
val sourceCRS = factory.createCoordinateReferenceSystem("4326") // WGS 84val targetCRS = factory.createCoordinateReferenceSystem("3857")
val operation = regops.createOperation(sourceCRS, targetCRS)
val coordinates = doubleArrayOf(
45.500, -73.567, // Montreal49.250, -123.100, // Vancouver35.653, 139.839, // Tokyo48.865, 2.349// Paris
)
operation.mathTransform.transform(
coordinates, 0, // Source coordinates.
coordinates, 0, // Target coordinates (overwriting the source).4// Number of points to transform.
)
System.out.printf("Montreal: %11.1f %11.1f%n", coordinates[0], coordinates[1])
System.out.printf("Vancouver: %11.1f %11.1f%n", coordinates[2], coordinates[3])
System.out.printf("Tokyo: %11.1f %11.1f%n", coordinates[4], coordinates[5])
System.out.printf("Paris: %11.1f %11.1f%n", coordinates[6], coordinates[7])
} catch (e:Exception) {
Log.d("proj", e.localizedMessage.toString())
}
}
This code throws an error: "throw new UnsatisfiedLinkError("Missing native file: " + nativeFile);".
I found that the root cause of the issue is a mismatch between the architecture of "libproj-binding.dylib" (macOS) or "libproj-binding.so" (Linux) and the Android system (APK) which uses ARM64 architecture.
Anyone Please help me generate the native file for the ARM64 architecture ?.
The text was updated successfully, but these errors were encountered:
I follow the following steps as per documents :
I have built the repository for macOS on Intel-based systems and for Linux systems.
I have created the native files and .jar files as expected.
java --class-path target/proj-2.1-SNAPSHOT.jar example/TransformPoints.java
.I need to use these .jar files in my Android project, which is based on Kotlin Compose. I have imported the "proj-2.1-SNAPSHOT.jar" file and can access its classes.
This .jar file produces the expected results when run in the terminal on my macOS laptop.
However, when I try to build the Android project to generate a debug APK, I encounter an error.
In Java, there is a file named "NativeResource.java" that contains a function called "libraryPath." This function imports a native file named "libproj-binding.dylib" (for macOS) or "libproj-binding.so" (for Linux).
The text was updated successfully, but these errors were encountered: