Closed connorpmullins closed 5 months ago
Update to this - I receive the same error even when not overriding a mapbox version.
@connorpmullins looking at first error:
e: file:///Users/connormullins/Code/Omnia/NavionicsMapboxTest/node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXPointAnnotationModule.kt:12:1 Class 'RNMBXPointAnnotationModule' is not abstract and does not implement abstract base class member public abstract fun refresh(viewRef: Double?, promise: Promise!): Unit defined in com.rnmapbox.rnmbx.NativeRNMBXPointAnnotationModuleSpec
We do have
@ReactMethod
override fun refresh(viewRef: ViewRefTag?, promise: Promise) {
in RNMBXPointAnnotationModule.kt
and there is the generated
@ReactMethod
@DoNotStrip
public abstract void refresh(@Nullable Integer viewRef, Promise promise);
in NativeRNMBXPointAnnotationModuleSpec.java.
So looks like the kotlin and java definition doesn't match. Might be a compiler version or kotlin settings issue.
Can you check your ? NativeRNMBXPointAnnotationModuleSpec.java
?
Seems like it's related to https://github.com/rnmapbox/maps/pull/3527
Hey Miklós - here's my NativeRNMBXPointAnnotationModuleSpec.java (after upgrading to 10.1.27
):
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleJavaSpec.js
*
* @nolint
*/
package com.rnmapbox.rnmbx;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class NativeRNMBXPointAnnotationModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
public static final String NAME = "RNMBXPointAnnotationModule";
public NativeRNMBXPointAnnotationModuleSpec(ReactApplicationContext reactContext) {
super(reactContext);
}
@Override
public @Nonnull String getName() {
return NAME;
}
@ReactMethod
@DoNotStrip
public abstract void refresh(@Nullable Double viewRef, Promise promise);
}
The issue is still occurring on the most recent release
@connorpmullins interesting, what is your react-native release?
Also are you running autogenerate? How come the module spec NativeRNMBXPointAnnotationModuleSpec.java is different than in our source code?
0.73.6!
And how can I check if I'm running auto-generate? Sorry to not be of more help, but I'm not sure why the module spec is different.
I've wiped and re-installed node modules, cleaned android, attempted to match our app (and our shared sandbox app) to the react native docs, and am still getting the above.
@connorpmullins sorry I cannot help. In our repo we have
in your fork you have
- public abstract void refresh(@Nullable Integer viewRef, Promise promise);
+ public abstract void refresh(@Nullable Double viewRef, Promise promise);
Ok I see.
This is old version of our code, the latest version of our code supports only RN 0.74 in the new arch.
So either you use our code before https://github.com/rnmapbox/maps/releases/tag/v10.1.21 with RN 0.73 on new arch. Or upgrade to RN 0.74 and use the latest version of our code.
Hello @mfazekas, I have the error with the updateCameraStop, it appears only when I activate the new architecture.
updateCameraStop
Error: Exception in HostFunction: no non-static method "Lcom/rnmapbox/rnmbx/components/camera/RNMBXCameraModule;.updateCameraStop(Ljava/lang/Double;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V"
package
"@rnmapbox/maps": "10.1.27", "react": "18.2.0", "react-native": "0.74.2",
node_modules - RNMBXCameraModule.kt
package com.rnmapbox.rnmbx.components.camera
import com.facebook.react.bridge.Callback
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.WritableMap
import com.facebook.react.bridge.WritableNativeMap
import com.rnmapbox.rnmbx.NativeRNMBXCameraModuleSpec
import com.rnmapbox.rnmbx.components.mapview.CommandResponse
import com.rnmapbox.rnmbx.utils.ViewTagResolver
class RNMBXCameraModule(context: ReactApplicationContext, val viewTagResolver: ViewTagResolver) : NativeRNMBXCameraModuleSpec(context) {
private fun withViewportOnUIThread(
viewRef: Double?,
reject: Promise,
fn: (RNMBXCamera) -> Unit
) {
if (viewRef == null) {
reject.reject(Exception("viewRef is null"))
} else {
viewTagResolver.withViewResolved(viewRef.toInt(), reject, fn)
}
}
private fun createCommandResponse(promise: Promise): CommandResponse = object : CommandResponse {
override fun success(builder: (WritableMap) -> Unit) {
val payload: WritableMap = WritableNativeMap()
builder(payload)
promise.resolve(payload)
}
override fun error(message: String) {
promise.reject(Exception(message))
}
}
companion object {
const val NAME = "RNMBXCameraModule"
}
override fun updateCameraStop(viewRef: Double?, stop: ReadableMap, promise: Promise) {
withViewportOnUIThread(viewRef, promise) {
it.updateCameraStop(stop)
promise.resolve(null)
}
}
}
@IASV that's sounds like another issue - see #3522
i tried modify in android\gradle.properties
newArchEnabled=false
and it worked
Environment
Steps to reproduce
Set up a bare-bones react native app with the following package.json:
Then attempt to build Android using the new architecture and mapbox v11. After doing that, I receive the following build errors:
@mfazekas - I have pushed the code required to replicate this to the
v11Sandbox
branch of our shared repository if you are interested in easily replicating the issue. I believe it's generalizable beyond our repo.Worth noting: this issue does NOT exist in version 10.1.19. I can't downgrade to 10.1.19, however, as iOS newArch apps have build issues with v11 on that release.