0

I'm trying to learn Augmented Reality Programming in Kotlin. I decided to give sceneform animations a shot. Basic examples seemed to work as expected until I decided to add animations to the mix. The app seems to crash at startup with the error "java.lang.NoSuchMethodError: No virtual method setUpdateMode(Lcom/google/ar/core/Config$UpdateMode;)V in class Lcom/google/ar/core/Config; or its super classes (declaration of 'com.google.ar.core.Config' appears in /data/app/com.thyagash.hellosceneform-_6rmQhoIu940ZX2hnqARzQ==/base.apk!classes3.dex)". Not sure how to proceed

I'm a beginner with sceneform animations and Kotlin in general, but I've tried going through the java code as per the LOGCAT output. I have extended the ArFragment base class to try and set the update mode myself, even though that seemed rather unnecessary. Didn't work. I followed the sample at https://github.com/google-ar/sceneform-android-sdk/tree/master/samples/animation which works fine

How does one go about debugging such issues? Is there anything I'm missing here?

build.gradle

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.afollestad.material-dialogs:core:3.0.0-rc3'
implementation 'com.afollestad.material-dialogs:bottomsheets:3.0.0-rc3'

// Provides ArFragment, and other Sceneform UX resources:
implementation "com.google.ar.sceneform.ux:sceneform-ux:1.9.0"

implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'

implementation "com.google.ar.sceneform:animation:1.10.0"

App crashes immediately on startup with the following messages at LOGCAT:

2019-06-29 19:55:53.158 3886-3886/com.thyagash.hellosceneform E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.thyagash.hellosceneform, PID: 3886
    java.lang.NoSuchMethodError: No virtual method setUpdateMode(Lcom/google/ar/core/Config$UpdateMode;)V in class Lcom/google/ar/core/Config; or its super classes (declaration of 'com.google.ar.core.Config' appears in /data/app/com.thyagash.hellosceneform-_6rmQhoIu940ZX2hnqARzQ==/base.apk!classes3.dex)
        at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:349)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:311)
        at androidx.fragment.app.Fragment.performResume(Fragment.java:2498)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1501)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3269)
        at androidx.fragment.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3241)
        at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:223)
        at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:538)
        at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:527)
        at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:172)
        at android.app.Activity.performResume(Activity.java:7336)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3953)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3993)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1934)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6940)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
RalfFriedl
  • 1,134
  • 3
  • 11
  • 12
  • 1
    A NoSuchMethodError often means you're running with a different version of a library from that you compiled with. (I don't know Android, so I can't help directly, but does that give you an idea where to look?) – gidds Jun 29 '19 at 14:58
  • @gidds were that the case, wouldn't it crash all the time irrespective of whether or not animations are imported? The error goes away when I remove "implementation "com.google.ar.sceneform:animation:1.10.0" – user9749282 Jun 29 '19 at 16:25
  • It depends.  For example, the JVM would still be able to load the class even if it were the wrong version, and wouldn't notice the difference until it tried to call a non-existent method.  So if it didn't get as far as trying to call that method, it wouldn't notice the mismatch.  (As I said, I don't know Android, but it may well be similar.) – gidds Jul 02 '19 at 14:12
  • You don't need to take my word for it, though — just look at [all](https://stackoverflow.com/questions/35186) [the](https://stackoverflow.com/questions/48233192) [previous](https://stackoverflow.com/questions/27223963) [answers](https://stackoverflow.com/questions/6798767) to this sort of question! – gidds Jul 02 '19 at 14:18
  • @gidds is correct, try deleting your .m2 cache for that specific project or library it may help. Unix/Mac OS X – ~/.m2/repository although for me it's under Users/First.last/ -- you may have to use CMD + Shift + . in mac to see hidden folders Windows – C:\Users\{your-username}\.m2\repository – Blaze Gawlik Oct 12 '21 at 04:16

0 Answers0