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

Problem updating the sample project #713

Closed
RobLewis opened this issue Aug 16, 2020 · 9 comments
Closed

Problem updating the sample project #713

RobLewis opened this issue Aug 16, 2020 · 9 comments
Labels
bug Bug that is caused by the library

Comments

@RobLewis
Copy link

Describe the bug
Attempt to update my sample project from the GitHub repository gives errors.

To Reproduce
Have an old copy of the sample project in local Android Studio.
Attempt to update project from GitHub.

Expected behavior
An error-free project should be created.

Actual behavior
RxBleGattCallback has compiler errors:
import bleshadow.… statements give "Cannot resolve symbol bleshadow" errors
(l. 59): return Observable.error(bleGattException); gives error that required type is android.database.Observable<?>; provided type is io.reactivex.Observable
(l. 288): errorMapper function is the wrong type
(l. 302): disconnectionRouter is the wrong type
(l. 309): getOnConnectionStateChange is the wrong type
(l. 314 and several following): cannot resolve method delay in Observable
(l. 329): getOnCharacteristicChanged is the wrong type

Additional context
Android Studio v. 4.0.1

@RobLewis RobLewis added the bug Bug that is caused by the library label Aug 16, 2020
@RobLewis
Copy link
Author

I updated all the dependencies and then noticed that the following classes are also generating errors:
NotificationAndIndicationManager
CharacteristicWriteOperation
ConnectionOperationQueueImpl
Errors include "Cannot resolve method filter in Observable", and inability to resolve the @Inject and @Named annotations.

@RobLewis
Copy link
Author

After updating the project it appears that I'm down to a single error: "Cannot resolve symbol 'DaggerClientComponent'" in the class RxBleClient.

@dariuszseweryn
Copy link
Owner

Hello Rob!
I think this is related to an old #627 issue. Dagger is shadowed in this project and shadow configuration cannot be done well enough for Android Studio. After building the project DaggerClientComponent should get generated.

@RobLewis
Copy link
Author

After updating the project it appears that I'm down to a single error: "Cannot resolve symbol 'DaggerClientComponent'" in the class RxBleClient.

@RobLewis
Copy link
Author

Sorry, but I don't know what "shadowed in this project" means. Could you briefly explain?

@dariuszseweryn
Copy link
Owner

Shadowed i.e. renaming a library's original package so multiple copies of this library could be used in a single application without a package clash (which may lead to runtime crashes if newer version of the lib is not backwards compatible). This was an issue quite a long time ago.

@RobLewis
Copy link
Author

RobLewis commented Sep 2, 2020

Damn, now it seems we're headed down a rabbit hole because I don't know what a "package clash" is. Here's my best guess: can you confirm/deny/explain?

  • A given application bundle may require multiple copies of a library, and these different copies/versions may have incompatibilities.

  • To enable the build system to correctly link up the various copies, we rename them. This seems to be what is meant by "shadowing", but how does this actually take place? Is it automatic in some sense? Does the list of dependencies have to be changed in some way?

  • I'm guessing that if all versions of libraries were backward-compatible, none of this would be necessary. True?

I'm sure I have more questions, but this will do for now. I appreciate any help! (I realize that questions like this might be better for Stack Overflow, but any quick tips might solve my problem.)

@dariuszseweryn
Copy link
Owner

A given application bundle may require multiple copies of a library, and these different copies/versions may have incompatibilities.

Correct. If in newer version of the library breaking change will appear then all dependencies that used this library as their dependency will stop working.

To enable the build system to correctly link up the various copies, we rename them. This seems to be what is meant by "shadowing", but how does this actually take place? Is it automatic in some sense? Does the list of dependencies have to be changed in some way?

Correct. There is a "Shadow" library I linked in the previous post which does this renaming. I did not do the setup but it seems to be automatic — only the source code needs to have references to shadowed classes (which get generated only after project will build successfully) and Android Studio does not always pick them up correctly

I'm guessing that if all versions of libraries were backward-compatible, none of this would be necessary. True?

Correct.

@dariuszseweryn
Copy link
Owner

With e8fdb96 this problem should finally be a thing of the past 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is caused by the library
Projects
None yet
Development

No branches or pull requests

2 participants