Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash - didn't find class "io.realm.internal.network.NetworkStateReceiver" #3505

Closed
lukcz opened this issue Sep 27, 2016 · 52 comments
Closed
Assignees

Comments

@lukcz
Copy link

lukcz commented Sep 27, 2016

Hi, with the new Realm 2.0 I am getting crash as below:

java.lang.RuntimeException: Unable to instantiate receiver io.realm.internal.network.NetworkStateReceiver: java.lang.ClassNotFoundException: Didn't find class "io.realm.internal.network.NetworkStateReceiver"
@Zhuinden
Copy link
Contributor

Zhuinden commented Sep 27, 2016

Did you do a Clean + Rebuild? (you should)

Do you have Instant Run disabled? (you should)

@zaki50
Copy link
Contributor

zaki50 commented Sep 28, 2016

I reproduced this.

conditions:
syncEnabled is false.
android.net.conn.CONNECTIVITY_CHANGE broadcast is fired.

The easiest way to reproduce this is to execute adb shell am broadcast -a android.net.conn.CONNECTIVITY_CHANGE

@peterbetos
Copy link

This is reproducible.

@mikelis-kaneps
Copy link

Yes, I have the same problem. Is there a way how to fix this?

@Zhuinden
Copy link
Contributor

2.0.1 will fix it

@r-cohen
Copy link

r-cohen commented Sep 28, 2016

++;

@mishindmitriy
Copy link

I have the same problem

@usernotnull
Copy link

+1

1 similar comment
@smoonsf
Copy link

smoonsf commented Sep 29, 2016

+1

@EspoirX
Copy link

EspoirX commented Sep 29, 2016

I have also encountered this problem

@zaki50
Copy link
Contributor

zaki50 commented Sep 29, 2016

already fixed in releases branch.
please wait a bit

@lyfebackup
Copy link

Same here, when can we expect 2.0.1?

@cmelchior
Copy link
Contributor

cmelchior commented Sep 29, 2016

@Dimous Only our Mobile Platform Extension does that. Mostly because it allows us to do more intelligent error handling.

We hope to be able to ship 2.0.1 today with a fix for this, and sorry for letting such a server error slipping through 😢

@Domacoski
Copy link

+1

1 similar comment
@samvanderhyden
Copy link

+1

@GulajavaMinistudio
Copy link

Same here, when can we a bug fix release ?

@ghost
Copy link

ghost commented Sep 30, 2016

+1

@hateum
Copy link

hateum commented Sep 30, 2016

is there any way to prevent the crash ?

@Zhuinden
Copy link
Contributor

Well until 2.0.1 is released, you can add a broadcast receiver by the same name in the same package and all that.

@hateum
Copy link

hateum commented Sep 30, 2016

I added this class to my project with the same package Realm and now there is no crash.
https://github.com/realm/realm-java/blob/1062d2462eaf841c215d7962dea979f65032fb5a/realm/realm-library/src/objectServer/java/io/realm/internal/network/NetworkStateReceiver.java
Thanks

@pauloleitemoreira
Copy link

+1

2 similar comments
@takke
Copy link

takke commented Oct 1, 2016

+1

@avalenzuelac
Copy link

+1

@shahrukhamd
Copy link

shahrukhamd commented Oct 3, 2016

I shipped my app to production with Realm 2.0.0 and because of this issue my crash free users are at 17.5% only (down from 99.8%). Please fix that issue ASAP.

I am thinking about removing Realm altogether as my database model is pretty simple.

@pratamawijaya
Copy link

+1

@cchcc
Copy link

cchcc commented Oct 4, 2016

+1

2 similar comments
@ezanetta
Copy link

ezanetta commented Oct 4, 2016

+1

@jsadovskaya
Copy link

+1

@fuwaneko
Copy link

fuwaneko commented Oct 4, 2016

I also shipped an app like @shahrukhamd, and it's horrible now. We depend on third-party libraries and expect releases to be stable and well-tested. This is critical issue and it can potentially destroy your reputation since it's been 7 days already. Also my app now is never closed by the system since Realm listens to network changes. This is totally unacceptable. I understand you want to make money, but it should not interfere with my application in a way that changes it's behaviour. That was the reason I dropped Firebase Crashes in favour of Fabric, since Firebase launched separate process to track crashes which is what I totally don't want.

@cmelchior
Copy link
Contributor

Hi @fuwaneko
We are sorry that this error got shipped in 2.0, and we actually wanted to ship a fix last week, but ran into some problems with our build systems unfortunately. Those should be fixed now and we plan to ship 2.0.1 today.

@fuwaneko
Copy link

fuwaneko commented Oct 4, 2016

@cmelchior thank you. I also hope with syncEnabled = false Realm will not listen to network changes.

@cmelchior
Copy link
Contributor

It will not, it was a mistake it was in the base library. It will only be included in the sync part.

@Zhuinden
Copy link
Contributor

Zhuinden commented Oct 4, 2016

The snapshot I tried out didn't have this issue, I think this got merged in from realm-java-private ¬¬

@estebanlagord
Copy link

+1 waiting for 2.0.1

@sankar4n
Copy link

sankar4n commented Oct 4, 2016

Same here, waiting for 2.0.1 :(

@ahmadalibaloch
Copy link

Waitinggggggggggggggggg 🗡

@pishguy
Copy link

pishguy commented Oct 4, 2016

+1 and i get the same error

@JSONValidator
Copy link

+1

@Zhuinden
Copy link
Contributor

Zhuinden commented Oct 4, 2016

It's going to happen eventually.

@kristakrebs
Copy link

+1 2.0.1

@readytopark
Copy link

+1

1 similar comment
@allentcm
Copy link

allentcm commented Oct 5, 2016

+1

@ahmadalibaloch
Copy link

Where is the Realm team sleeping. Recently the have been boasting to release new features and this fatal bug is not resolved after weeks 👎

@Zhuinden
Copy link
Contributor

Zhuinden commented Oct 5, 2016

@ahmadalibaloch ...man, they do know about it. Realm 2.0 has been barely out for a week, saying it hasn't been fixed for weeks is a major exaggeration and wrong, too.

If you really actually wanted to create a quick fix for this problem in the meantime, you would have just added the missing class and released a new version of your app.

https://github.com/realm/realm-java/blob/1062d2462eaf841c215d7962dea979f65032fb5a/realm/realm-library/src/objectServer/java/io/realm/internal/network/NetworkStateReceiver.java

(I am still not an official Realm person).

@pc-bszabo
Copy link

pc-bszabo commented Oct 5, 2016

Quick and dirty solution : put this into your launcher activity OR Application=>

try {
getApplicationContext().getPackageManager().setComponentEnabledSetting(new ComponentName("your.package.name","io.realm.internal.network.NetworkStateReceiver"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
} catch (Exception e) {}

@Zhuinden
Copy link
Contributor

Zhuinden commented Oct 5, 2016

I actually didn't know you could do that. Cool.

@sankar4n
Copy link

sankar4n commented Oct 5, 2016

awesome @pc-bszabo! I have added the following code to Application onCreate

try {
            ComponentName componentName = new ComponentName(
                    getApplicationContext(),
                    "io.realm.internal.network.NetworkStateReceiver"
            );
            getPackageManager()
                    .setComponentEnabledSetting(
                            componentName,
                            PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                            PackageManager.DONT_KILL_APP);
} catch (Exception ignored) {}

and it works!

Someone has written a blog on disabling BroadcastReceivers

@ahmadalibaloch
Copy link

@pc-bszabo Thanks a lot.

@cmelchior
Copy link
Contributor

2.0.1 has just been released fixing this bug. The network receiver is now only added if you enable Sync as well.

I could list all the technical and process difficulties involved in getting this release out the door, but in reality we just dropped the ball on this, and I'm very sorry for those of you that got affected by this. We can only strive to do better in the future.

Closing.

@ahmadalibaloch
Copy link

We appreciate your hard work. 👍

@XabierGoros
Copy link

Indeed we appreciate the work of the Realm team. On the other side, IMHO we should be more cautious when criticising and hurrying up a team like this whose software is open sourced for us.

Once again, thanks!

nathb added a commit to nathb/SwiftShop that referenced this issue Oct 9, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests