mdrajibsk8 / react-native-device-number

MIT License
3 stars 7 forks source link

Production app crashes on android: [Fatal Exception: java.lang.NoSuchFieldError] #14

Open supmanyu opened 4 months ago

supmanyu commented 4 months ago

I've been getting reports of the app crashing whenever the library is triggered from the react-native side. Attaching the firebase crashlytics error trace below:

Fatal Exception: java.lang.NoSuchFieldError: No field CREDENTIALS_API of type Lcom/google/android/gms/common/api/Api; in class Lcom/google/android/gms/auth/api/Auth; or its superclasses (declaration of 'com.google.android.gms.auth.api.Auth' appears in /data/app/~~P9ZvDb0sekwXPMrz-zK69A==/com.package.name-7N6gBzn7zT2bR5O-36inUg==/base.apk!classes2.dex)
       at com.reactlibrary.devicenumber.DeviceNumberActivity.a(DeviceNumberActivity.java:1)
       at com.reactlibrary.devicenumber.DeviceNumberActivity.onCreate(DeviceNumberActivity.java:3)
       at android.app.Activity.performCreate(Activity.java:8422)
       at android.app.Activity.performCreate(Activity.java:8395)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1403)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3845)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4014)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:111)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2470)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:240)
       at android.os.Looper.loop(Looper.java:351)
       at android.app.ActivityThread.main(ActivityThread.java:8423)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Environment react-native: 0.68.5

AjayGol commented 4 months ago

same issue i have get

Nitish33 commented 4 months ago

Just add this line in your app/build.gradle file, and it should work configurations.all { resolutionStrategy.eachDependency { details -> if (details.requested.group == 'com.google.android.gms' && details.requested.name == 'play-services-auth') { details.useVersion '20.7.0' } } }

Basically we are forcing this library to use slightly older version of play-service-auth as v21.0.0 of play-service-auth has introduced some breaking changes https://developers.google.com/android/guides/releases#february_15_2024

sulaimaan26 commented 4 months ago

When this will be fixed Any ETA please

supmanyu commented 4 months ago

@Nitish33 thanks for the workaround, but its not really a fix as Google might stop accepting builds with older versions of play-services-auth

mdrajibsk8 commented 4 months ago

Kindly check the new version(v1.0.9) and do let me know if it fixes the issue. thanks

supmanyu commented 4 months ago

@mdrajibsk8 still crashing for us with the newer play-services-auth versions

sulaimaan26 commented 4 months ago

Still the issue occurs

mdrajibsk8 commented 4 months ago

Please share your package.json and both build.gradle file so I can have a look into that @supmanyu If you have any problem share the build.gradle file, you can share the screenshot of the play services in both of the files. thanks

tuanlam92 commented 3 months ago

Same issue.