I'm attempting to develop a basic AR app with a target, but it crashes on Android in this section ViroARTrackingTargets.createTargets, while it works fine on iOS.
Instead of cloning the Viro template, I integrated the library directly into my existing app.
When I remove the ViroARTrackingTargets.createTargets section; and I program a simple 'Hello World' message in the scene, it works fine, it doesn't crash.
When the crash occurs, there is no React log whatsoever. Therefore, I resorted to using logcat to obtain some potentially useful information. I hope this helps in diagnosing the issue.
01-17 21:58:36.885 5788 5788 I com.my-app: Late-enabling -Xcheck:jni
01-17 21:58:36.898 5788 5788 I com.my-app: Using CollectorTypeCC GC.
01-17 21:58:37.267 5788 5788 W com.my-app: Accessing hidden field Landroid/view/View;->mKeyedTags:Landroid/util/SparseArray; (unsupported, reflection, allowed)
01-17 21:58:37.267 5788 5788 W com.my-app: Accessing hidden field Landroid/view/View;->mListenerInfo:Landroid/view/View$ListenerInfo; (unsupported, reflection, allowed)
01-17 21:58:37.267 5788 5788 W com.my-app: Accessing hidden field Landroid/view/View$ListenerInfo;->mOnClickListener:Landroid/view/View$OnClickListener; (unsupported, reflection, allowed)
01-17 21:58:37.322 5788 5788 W com.my-app: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
01-17 21:58:37.322 5788 5788 W com.my-app: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
01-17 21:58:38.191 5788 5882 W com.my-app: Accessing hidden field Ljava/lang/reflect/Field;->accessFlags:I (unsupported, reflection, allowed)
01-17 21:58:38.224 5788 5882 W com.my-app: Entry not found
01-17 21:58:38.731 5788 5880 I ReactNativeJS: 'dimensions.height', 779.3777777777777
01-17 21:58:38.984 5788 5880 I ReactNativeJS: Running "my-app" with {"rootTag":21}
01-17 21:58:39.292 5788 5880 W com.my-app: CheckJNI: method to register "installJSIBindings" not in the given class. This is slow, consider changing your RegisterNatives calls.
01-17 22:00:31.624 6004 6004 I com.my-app: Late-enabling -Xcheck:jni
01-17 22:00:31.638 6004 6004 I com.my-app: Using CollectorTypeCC GC.
01-17 22:00:32.011 6004 6004 W com.my-app: Accessing hidden field Landroid/view/View;->mKeyedTags:Landroid/util/SparseArray; (unsupported, reflection, allowed)
01-17 22:00:32.011 6004 6004 W com.my-app: Accessing hidden field Landroid/view/View;->mListenerInfo:Landroid/view/View$ListenerInfo; (unsupported, reflection, allowed)
01-17 22:00:32.011 6004 6004 W com.my-app: Accessing hidden field Landroid/view/View$ListenerInfo;->mOnClickListener:Landroid/view/View$OnClickListener; (unsupported, reflection, allowed)
01-17 22:00:32.066 6004 6004 W com.my-app: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
01-17 22:00:32.066 6004 6004 W com.my-app: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
01-17 22:00:32.934 6004 6096 W com.my-app: Accessing hidden field Ljava/lang/reflect/Field;->accessFlags:I (unsupported, reflection, allowed)
01-17 22:00:32.965 6004 6096 W com.my-app: Entry not found
01-17 22:00:33.470 6004 6095 I ReactNativeJS: 'dimensions.height', 779.3777777777777
01-17 22:00:33.723 6004 6095 I ReactNativeJS: Running "my-app" with {"rootTag":21}
01-17 22:00:34.027 6004 6095 W com.my-app: CheckJNI: method to register "installJSIBindings" not in the given class. This is slow, consider changing your RegisterNatives calls.
01-17 22:00:34.160 6004 6095 I ReactNativeJS: 'RESOURCES', undefined
01-17 22:00:34.418 6004 6095 W ReactNativeJS: [ReferenceError: Property 'resultSource' doesn't exist], '\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:253836:26)\n at StaticContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:180083:17)\n at EnsureSingleNavigator (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:175884:24)\n at SceneView (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:179988:22)\n at RCTView\n at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:60060:43)\n at RCTView\n at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:60060:43)\n at Background (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:181732:21)\n at Screen (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:182751:108)\n at RNSScreen\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:76073:62)\n at Suspender (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:192737:22)\n at Suspense\n at Freeze (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:192756:23)\n at DelayedFreeze (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:191933:22)\n at InnerScreen (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:191982:36)\n at Screen (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:192258:36)\n at MaybeScreen (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:191810:24)\n at RNSScreenContainer\n at ScreenContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:192114:31)\n at MaybeScreenContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:191799:23)\n at RCTView\n at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:60060:43)\n at RCTView\n at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:60060:43)\n at AnimatedComponent(View) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:147914:38)\n at RCTView\n at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:60060:43)\n at AnimatedComponent(View) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:147914:38)\n at PanGestureHandler (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.my-app&modulesOnly=false&runModule=true:183
01-17 22:00:34.476 6004 6004 D com.my-app: PlayerBase::PlayerBase()
01-17 22:00:34.476 6004 6004 D com.my-app: TrackPlayerBase::TrackPlayerBase()
01-17 22:00:34.650 6004 6004 W com.my-app: Accessing hidden field Landroid/widget/ScrollView;->mScroller:Landroid/widget/OverScroller; (unsupported, reflection, allowed)
01-17 22:00:34.674 6004 6004 I ReactNative: [GESTURE HANDLER] Initialize gesture handler for root view com.facebook.react.ReactRootView{fb06053 V.E...... ......ID 0,0-1080,2192 #15}
01-17 22:00:34.743 6004 6136 D com.my-app: PlayerBase::stop() from IPlayer
01-17 22:00:35.011 6004 6004 W com.my-app: Loading /data/app/~~P-6H3B2yWnQ8LIGF6ty6tw==/com.google.ar.core-Jw0JKuyZliOxH8XROqsBNw==/oat/arm64/base.odex non-executable as it requires an image which we failed to load
01-17 22:00:35.014 6004 6004 W com.my-app: Entry not found
01-17 22:00:35.016 6004 6004 W com.my-app: Entry not found
01-17 22:00:35.655 6004 6145 D com.my-app: PlayerBase::stop() from IPlayer
01-17 22:00:36.390 6004 6004 D com.my-app: PlayerBase::stop() from IPlayer
I'm attempting to develop a basic AR app with a target, but it crashes on Android in this section
ViroARTrackingTargets.createTargets
, while it works fine on iOS. Instead of cloning the Viro template, I integrated the library directly into my existing app. When I remove theViroARTrackingTargets.createTargets
section; and I program a simple 'Hello World' message in the scene, it works fine, it doesn't crash.When the crash occurs, there is no React log whatsoever. Therefore, I resorted to using logcat to obtain some potentially useful information. I hope this helps in diagnosing the issue.
Development OS: MacOS M3, Sonoma 14.2.1 react: "18.2.0", react-native: "0.73.2", @viro-community/react-viro: "^2.23.0" Device: Samsung S20+, Android 13
Here there are the logcat logs
Here there is the code I'm using: