This repository has been archived by the owner on Jun 16, 2023. It is now read-only.
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.
Error while updating property 'cameraId' #2528
Closed
Description
After update to react-native-camera: "^3.6.0" and pass RN version 59.9 to androidX using jetifier and adding
android.useAndroidX=true
android.enableJetifier=true
to gradle.properties and implementation "androidx.appcompat:appcompat:1.0.0"
to android/build.gradle
and maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
to android/app/build.gradle
the cam start tl show:
Error while updating property 'cameraId' of a view managed by: RNCamera
Someone facing the same issue?
Activity
sibelius commentedon Oct 9, 2019
cc @cristianoccazinsp
cristianoccazinsp commentedon Oct 9, 2019
Is there a stack trace? Can you check Android Studio / Logcat?
Also, shouldn't androidX be for RN >= 0.60? If you are using RN < 0.60, you need the "reverse" jetifier to go from androidX to appcompat. Correct me if I'm wrong.
Also as written in the migration helper from RN (https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.6), you shouldn't be adding appcompat at all if using RN >= 0.60
haikov commentedon Oct 28, 2019
I see the same crashes from time to time in Crashlytics. I wasn't able to reproduce them locally, but I noticed that they happen only on Android 4 and only on Samsung devices (maybe it will help to get some clue).
I'm on React Native
0.61.2
andreact-native-camera
is3.8.0
.I'm also able to attach a stack trace:
cristianoccazinsp commentedon Oct 28, 2019
That stack trace seems to be first useful info provided!
Caused by java.lang.NoClassDefFoundError: java.util.Objects
Can you confirm this only happens on Android 4? This probably explains it.
If this is the issue, how come it wasn't detected at compile time?
Maybe this issue is related? #2559 (comment)
Try checking the solution there for Android 4.
haikov commentedon Oct 28, 2019
At least in my case, out of ~10k active devices, it's crashing only on Android 4.
It's interesting, why the app was compiled successfully. I'm going to try the solution of extending from
MultiDexApplication
and update on the progress here.cristianoccazinsp commentedon Oct 28, 2019
It should definitely be crashing if you're using a target SDK < 19. This is also probably a bug since
Objects.equals
seems to be only included in SDK 19 or above.cristianoccazinsp commentedon Oct 28, 2019
I've compiled the example app just fine, so the error will most likely not be detected at compile time, even with SDK 16, which is odd.
However, I can't seem to actually run the example app. Everything builds fine but fails to run due to unresolved modules, jest-haste-map issues, watchman issues, etc. I'm most likely doing something wrong though.
haikov commentedon Oct 28, 2019
I have
minSdk
set to 16 and the app compiles successfully all the time.Do I understand correctly that the app crashes on this line?
https://github.com/react-native-community/react-native-camera/blob/7abc7c2e01b1c1bb71646d8e1ec8957fa2491062/android/src/main/java/com/google/android/cameraview/Camera1.java#L294
After some research I've found that it's possible to replace it with something like:
Which makes sense for me.
cristianoccazinsp commentedon Oct 28, 2019
That line and the one below which also uses Objects.equals are most likely the issue. I have no idea why that wouldn't be detected at compile time (it's Java, it should!). Is this change something you could test with Android 4 (not 4.4)?
gbalduzzi commentedon Oct 29, 2019
Hi, I'm the author of #2559 , after fixing that issue I run into this one (with way fewer devices though)
I can confirm this is not a multiDex-related issue and that it does only happen on devices with android below 4.4.
If it is a compatibility issue, it is really very strange that the compiler does not detect it
6 remaining items