Hi, we have several unit tests in our app (based on 200.1.0). When I create a point as shown below, I get a NoClassDefFound for CoreSpatialReference.
Point(
point.latitude,
point.longitude,
SpatialReference(MapConstants.EPSG_CODE)
)
Do I have to do sth special during the setup of the build.gradle so that the classes are avaiable during testing?
The exact error is:
Could not initialize class com.arcgismaps.internal.jni.CoreSpatialReference
java.lang.NoClassDefFoundError: Could not initialize class com.arcgismaps.internal.jni.CoreSpatialReference
at com.arcgismaps.geometry.SpatialReference.<init>(SpatialReference.kt:210)
at de.bwi.kvib.mobile.core.network.model.vorgang.FeatureVorgangRouteFormKt.toPolylines(FeatureVorgangRouteForm.kt:30)
Edit: When I create a point without a SpatialReference, I get the following error:
java.lang.NoClassDefFoundError: Could not initialize class com.arcgismaps.internal.jni.CorePoint
This shows that my setup seems to be incorrect but I followed the steps from here:
https://developers.arcgis.com/kotlin/install-and-set-up/
Edit 2: Found a similar thread from two years ago. The solution proposes to do a ArcGISRuntime.initialize() but that class does not exist anymore. What is nowaday's equivalent?
Solved! Go to Solution.
Hi @padmalcon. Are you running these tests as non-instrumented tests? Unfortunately the SDK cannot be tested using non-instrumented tests, they must be put in the `androidTest` folder.
Hi @padmalcon. Are you running these tests as non-instrumented tests? Unfortunately the SDK cannot be tested using non-instrumented tests, they must be put in the `androidTest` folder.
Hi @HudsonMiears, thanks for your reply, we put the test(s) into the androidTest folder and the jni error disappears. It would be great if such information was provided in the documentation.