Issue
I'm building an android system with help of a youtube video and when I try to sync it to fire base, it shows the following error.
ERROR: Failed to resolve: com.github.mancj:MaterialSearchBar:0.8.2
Show in Project Structure dialog
Here is my code
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.mynewrealtimelocationtracker"
minSdkVersion 22
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Libraries
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.karumi:dexter:5.0.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.github.d-max:spots-dialog:1.1@aar'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.mancj:MaterialSearchBar:0.8.2'
//RxJava2
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
//Retrofit2
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'io.paperdb:paperdb:2.6'
}
I'm happy if somebody can explain me the purpose of having the below code.
implementation 'com.github.mancj:MaterialSearchBar:0.8.2'
Since I'm new to android I have no idea about above line.
Solution
It is a library for a search bar with material design style
https://github.com/mancj/MaterialSearchBar
If you haven't use it in xml then you can just remove it. I recommend you to do so, because if after removing it you keep having compiling errors then you have another error that is masked by that. Only after removing it and compiling you can know that was the problem and you can start fixing it.
Most likely the problem should be covered here
https://github.com/mancj/MaterialSearchBar/issues/51
The libraries that are needed for the Android API indicate it on the name, usually as androidx
. I'm guessing the root problem could be related with the copious amount of libraries that your are using.
If you are new to Firebase go to the docs and read the basic example for RTD this codelab should be enough
https://codelabs.developers.google.com/codelabs/firebase-android/#0
The rest of the libraries are just adding extra logic that could be a great architecture but you don't need to use Rx to use Firebase. There are other questionable stuff there as well, by example using paper db as a second database, what for if the project is already using Firebase real time database? This is a common problem with tutorials, my recommendation is follow the docs and then jump in more complexity gradually.
Answered By - cutiko
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)