resource android:attr/android:progressBarStyle not found - android

I've got this error when I tried to build my project after I updated Android Studio to the lastest version. I am getting below error:
C:\Users\YaCn.gradle\caches\transforms-2\files-2.1\5502c0022567bdcff063e0fb4352b137\folioreader-0.3.3\res\layout\progress_dialog.xml:10:
AAPT: error: resource android:attr/android:progressBarStyle not found.
that XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="#+id/layout_loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center">
<ProgressBar android:id="#+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/android:progressBarStyle"/>
<TextView android:id="#+id/label_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textSize="18sp"
android:textColor="#android:color/white"
android:text="#string/loading"/>
</LinearLayout>
</RelativeLayout>
build gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.admin.hashtab"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "654bcb8c-90a6-4012-924a-e18e5787a7de",
onesignal_google_project_number: "3520309722"]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services-analytics:12.0.1'
implementation 'com.onesignal:OneSignal:3.+#aar'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.github.ornolfr:rating-view:0.1.2#aar'
implementation project(path: ':library')
implementation project(path: ':SmoothCheckBox-master')
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.folioreader:folioreader:0.3.3'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.lmntrx.android.library.livin.missme:missme:0.1.5'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

Try adding this to your dependency
implementation "com.folioreader:folioreader:0.5.4"//this is just the updated version as of now
implementation 'com.android.support:multidex:1.0.3' // ( for androidx)
configurations.matching { it.name == '_internal_aapt2_binary' }.all {
config -> config.resolutionStrategy.eachDependency {
details -> details.useVersion("3.3.2-5309881")
}
}

You have used wrong syles.Just change your style to:
style="?android:attr/progressBarStyle"
instead of
style="?android:attr/android:progressBarStyle"

Make a new file in layout, name it progress_dialog.xml and paste this code.
<LinearLayout android:id="#+id/layout_loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center"
xmlns:android="http://schemas.android.com/apk/res/android">
<ProgressBar
android:id="#+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyle" />
<TextView
android:id="#+id/label_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textSize="18sp"
android:textColor="#android:color/white"
android:text="#string/loading" />
</LinearLayout>

Related

How to add a country code picker to app in Android Studio

implementation is in the build.gradle but I'm still getting "Cannot resolve class com.hbb20.CountryCodePicker" in main activity
This is the build.gradle:
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.assignment1'
compileSdk 33
defaultConfig {
applicationId "com.example.assignment1"
minSdk 21
targetSdk 33
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.hbb20:ccp:2.6.1'
}
This is the activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
tools:context=".MainActivity">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/ic_launcher_background"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:id="#+id/logo"/>
<com.hbb20.CountryCodePicker
android:layout_width="match_parent"
android:layout_height="50dp"
app:ccp_areaCodeDetectedCountry="true"
android:layout_centerInParen="true"
android:layout_marginleft="100dp"
android:layout_marginright="100dp"
android:id="#+id/contrycodePicker"
app:ccp_autoDetectCountry="true"
android:layout_above="#id/centerhorizontalline"/>
the <com.hbb20.countrycodepicker shows up as an error. I can't seem to find what the problem is

ERROR: Failed to resolve: viewpager - how to fix that?

I'm trying to use a viewpager in my app which used androidX but it showed me an error ERROR: Failed to resolve: viewpager Affected Modules: app after added implementation 'android.viewpager:viewpager:1.0.0' and Gradle project sync. I searched a lot but not found any solution.please any help thanks in advance.here is xml file.
xml file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Favourites.FavouriteLinks">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside"
app:popupTheme="#style/AppTheme.PopupOverlay"
tools:layout_conversion_absoluteHeight="56dp"
tools:layout_conversion_absoluteWidth="384dp" android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintVertical_bias="0.0">
<TextView
android:id="#+id/toolbar_title"
style="#style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="casual"
android:gravity="left"
android:text="Favourites Brochures"
android:textColor="#color/colorwhite"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_conversion_absoluteHeight="28dp"
tools:layout_conversion_absoluteWidth="56dp"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp"/>
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.tabs.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
app:tabSelectedTextColor="#android:color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="32dp"
app:layout_constraintTop_toTopOf="#+id/toolbar"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.04000002" android:id="#+id/tabLayout">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="21sp"
android:textStyle="bold"
android:text="tab2"
/>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tab1"
android:textSize="21sp"
android:textStyle="bold"
/>
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="508dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintVertical_bias="0.85"/>
</androidx.constraintlayout.widget.ConstraintLayout>
kotlin code
class FavouriteLinks : AppCompatActivity() {
//This is our viewPager
var viewPager: ViewPager? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_favourite_links)
setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowTitleEnabled(false)
viewPager = findViewById<ViewPager>(R.id.viewPager)
val pageAdapter = PageAdapter(supportFragmentManager, tabLayout.tabCount)
viewPager?.adapter = pageAdapter
}
}
gradle file
//noinspection GradleCompatible
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.nanotech.i_cardplatform"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
implementation 'com.google.android.material:material:1.0.0-alpha1'
//RETROFIT ... NETWORK LIBRARY
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
// RETROFIT .. CONVERTER
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
// Logging
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
// Room dependencies
implementation 'androidx.room:room-runtime:2.0.0-alpha1'
kapt 'androidx.room:room-compiler:2.0.0-alpha1'
annotationProcessor 'androidx.room:room-compiler:2.0.0-alpha1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'androidx.viewpager:viewpager:1.0.0'
}
repositories {
mavenCentral()
}
Do not add viewPager library separately it's already included in
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'

Application crashes on loading android chip component

Chip material component crash
I'm using android.support.design.chip.Chip material element using com.android.support:appcompat-v7:28.0.0 support library. App crashes with this error:
Caused by: android.view.InflateException: Binary XML file line #130: Binary XML file line #130: Error inflating class com.google.android.material.chip.Chip
Caused by: android.view.InflateException: Binary XML file line #130: Error inflating class com.google.android.material.chip.Chip
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.material.chip.Chip" on path: DexPathList[[zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/base.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_resources_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.m22_3.pilotapp-Em4FGoATeSyeWoDIACtXXA==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
I have already tried using this solution and replaced my theme parent with these:
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.Bridge
but still have that crash. I also Migrated to AndroidX but still no chance.
App gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.m22_3.pilotapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 6
versionName "2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
implementation 'com.github.florent37:expansionpanel:1.0.0'
implementation 'com.airbnb.android:lottie:2.5.5'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.9'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.9'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.9'
implementation 'org.glassfish:javax.annotation:10.0-b28'
implementation 'com.github.bumptech.glide:glide:4.6.1'
}
Project's gradle file:
buildscript {
repositories {
maven { url 'https://jitpack.io' } //https://jitpack.io or https://maven.google.com
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://jitpack.io'
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
XML code:
<CoodrdinateLayout>....<LinearLayout>.... <com.google.android.material.appbar.AppBarLayout
android:layout_width="200dp"
android:layout_height="wrap_content"
android:background="#color/transparent">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:measureAllChildren="false"
android:scrollbars="none">
<LinearLayout
android:id="#+id/filter_linear_layout_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cornered2_stroked_tab2color"
android:orientation="horizontal"
android:padding="5dp">
<com.google.android.material.chip.Chip
android:id="#+id/filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cornered_filled_tab2color"
android:padding="4dp"
android:text="#string/filter"
android:textColor="#color/white"
app:chipIcon="#drawable/filter"
app:closeIconEnabled="false"
app:singleLine="true" />
<com.google.android.material.chip.Chip
android:id="#+id/location_filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:closeIconEnabled="true"
app:singleLine="true" />
<com.google.android.material.chip.Chip
android:id="#+id/experience_filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:closeIconEnabled="true"
app:singleLine="true" />
<com.google.android.material.chip.Chip
android:id="#+id/timeInterval_filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:closeIconEnabled="true"
app:singleLine="true" />
<com.google.android.material.chip.Chip
android:id="#+id/industry_filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:closeIconEnabled="true"
app:singleLine="true" />
<com.google.android.material.chip.Chip
android:id="#+id/partFullTime_filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:closeIconEnabled="true"
app:singleLine="true" />
<com.google.android.material.chip.Chip
android:id="#+id/blueWhiteCollar_filter_chip_detailAc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:closeIconEnabled="true"
app:singleLine="true" />
</LinearLayout>
</HorizontalScrollView>
</com.google.android.material.appbar.AppBarLayout>
Would appreciate if someone could help.

In current theme failed to find style 'floatingActionButtonStyle'

Failed to find style 'floatingActionButtonStyle' in current theme.
I even tried doing this in my style.xml
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="floatingActionButtonStyle">#style/Widget.Design.FloatingActionButton</item>
</style>
It did not work. I used Base.theme because of appcompat problem I was facing . My appcompat is - 'com.android.support:appcompat-v7:28.0.0-alpha1
Here is the XML file where error is shown:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".MainActivity">
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:src="#drawable/ic_send"
android:id="#+id/fab"
android:tint="#android:color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
app:fabSize="mini"
/>
<android.support.design.widget.TextInputLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_toLeftOf="#+id/fab"
android:layout_alignParentBottom="true"
android:layout_toStartOf="#+id/fab"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
>
<EditText
android:id="#+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Message..."
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<ListView
android:id="#+id/list_of_message"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_above="#+id/fab"
android:dividerHeight="16dp"
android:divider="#android:color/transparent"
android:layout_marginBottom="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true">
</ListView>
</RelativeLayout>
Build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.hp.chatapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//add library
implementation 'com.android.support:design:27.1.1'
// implementation 'com.firebaseui:firebase-ui-database:4.1.0'
}
apply plugin: 'com.google.gms.google-services'
After all the comments this is what I came up to:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.hp.chatapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//add library
implementation 'com.android.support:design:27.1.1'
// implementation 'com.firebaseui:firebase-ui-database:4.1.0'
// consider using implementation 'com.firebaseui:firebase-ui-database:3.1.1'
// see the question below
}
apply plugin: 'com.google.gms.google-services'
I suggest using compileSdkVersion and targetSdkVersion 27 because, as you noticed,
28.0.0-alpha1 doesnt support FloatingActionButton style.
and might also cause problems as it is in alpha version.
Question about firebase-ui-database here.
Extra: You can search for libraries here and see how many people are using it or the release date.

Android MapBox inflating error

Hello I try to use MapBox Android SDK, but I have problem.
When APK is launched error shows like : Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.mapbox.mapboxsdk.views.MapView
I use Android studio.
My XML Layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mapbox.mapboxsdk.views.MapView
android:id="#+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:mapid="map ID "/>
<LinearLayout
android:id="#+id/llCardInfo"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#CCffffff"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingTop="8dp"
android:paddingRight="8dp"
android:paddingBottom="8dp"
android:orientation="horizontal">
<LinearLayout
android:orientation="horizontal"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.99">
<TextView
android:layout_width="match_parent"
android:layout_height="70dp"
android:text="Hello" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/ivCloseCard"
android:visibility="invisible"
android:src="#drawable/close_card_anim"
android:layout_width="40dp"
android:layout_height="40dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
And This is Fragment.
this is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
preDexLibraries = false
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.android.gms:play-services:5.0.77'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile project(':lib:SlidingMenu')
compile files('libs/okhttp-2.0.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/guava-17.0.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/disklrucache-2.0.2.jar')
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.3.0#aar'){
transitive=true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/android-support-v4.jar')
compile files('libs/Parse-1.5.1.jar')
}
The issue is being caused by overlapping versions of OkHttp. Mapbox Android 0.3.0 uses OkHttp 1.x and the provided Gradle dependency lists also contains OkHttp 2.0. This causes confusion at runtime with this error message being the result.
Mapbox Android 0.5.0 has addresses this issue and will allow parallel use of OkHttp 2.0.

Categories

Resources