Issue
I am trying to build an app in which I am implementing authentication using a "contact number" and therefore it requires use of 'country-code-picker' library. Even after declaring the country code picker library in my module(build.gradle) file, still I am getting this error while using it in my XML file.
Class referenced in the layout file, com.hbb20.CountryCodePicker, was not found in the project or the libraries
XML file
<com.hbb20.CountryCodePicker
android:id="@+id/ccp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
app:ccp_autoDetectCountry="true"
app:ccp_showNameCode="false"
tools:ccp_contentColor="#fcfdfd"
tools:ccp_textSize="20dp" />
build.gradle file
plugins {
id 'com.android.application'
id 'kotlin-android'
}
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.whatsappclone"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:28.1.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.hbb20:ccp:X.Y.Z'
}
Solution
Put in your dependencies like this -> implementation 'com.hbb20:ccp:2.5.0'
Answered By - franvillacis
Answer Checked By - Timothy Miller (JavaFixing Admin)