Customisation for Android BottomView - android

[![I want bottom bar like this][1]][1]
Using below library in android to customize bottom tab bar :
https://github.com/Droppers/AnimatedBottomBar
It is quite easy to use and provide many animation.
But, I don't want the menu text content to display in bottom bar.
I want only icons to display while it is selected or not selected.
How can I achieve with this library?
Or Is there any way to acheive such thing?

I went through the library mentioned, it does not support this feature currently, but we can tweak the code to make it work for your usecase, but to do that you need to include the code as a module/folder instead instead of dependency.
To achieve that, you need to follow below steps
You need to get rid of dependency of implementation 'nl.joery.animatedbottombar:library:1.0.9'
Clean project to remove it from cache
you can clone the code, add 'library' folder from code as a Android module, then include it in your gradle using implementation project(path: ':library')
Once above steps are done, you can modify the code to your needs. Now for your use case, do replace updateTabType method present at line#99 inside library/src/main/java/nl/joery/animatedbottombar/TabView.kt file to below
private fun updateTabType() {
animatedView = icon_layout
selectedAnimatedView = icon_layout //here we are forcing it use icon_layout for both views all the time
if (selectedAnimatedView.visibility == View.VISIBLE) {
animatedView.visibility = View.VISIBLE
selectedAnimatedView.visibility = View.INVISIBLE
} else {
animatedView.visibility = View.INVISIBLE
selectedAnimatedView.visibility = View.VISIBLE
}
bringViewsToFront()
}
Also the library is licensed under MIT Open Source License, so you can
happily change your own version of code free of cost.
Update
Also, in library modules gradle, please remove references to bintray, that is not required
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0.9"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles 'consumer-rules.pro'
}
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.61"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
}

If you see in the description of the repo, you will see there are some attributes regarding the tab appearance
add this app:abb_selectedTabType = "icon" to the code that you might have already added in the xml like below
<nl.joery.animatedbottombar.AnimatedBottomBar
android:id="#+id/bottom_bar"
android:background="#FFF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:abb_selectedTabType="text"
app:abb_indicatorAppearance="round"
app:abb_indicatorMargin="16dp"
app:abb_indicatorHeight="4dp"
app:abb_tabs="#menu/tabs"
app:abb_selectedTabType = "icon"
app:abb_selectedIndex="1" />

Related

GradleCompatible error: implementation 'com.android.support:appcompat-v7:28.0.0'

I am beginner to android development. When I build my android project, it is throwing an error
INFO: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: capacitor-android
I tried the solutions suggested in other topic at implementation 'com.android.support:appcompat-v7:28.0.0'
Can anyone help me please? Thank you for your time!
My build.gradle(capacitor-android) file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.novoda:bintray-release:0.9.1'
}
}
tasks.withType(Javadoc).all { enabled = false }
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
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'
}
}
lintOptions {
abortOnError false
}
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.android.support:appcompat-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
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'
implementation 'org.apache.cordova:framework:7.0.0'
}
def version = System.getenv("BINTRAY_PKG_VERSION")
publish {
userOrg = 'ionic-team'
repoName = 'capacitor'
groupId = 'ionic-team'
artifactId = 'capacitor-android'
if (version != null) {
publishVersion = System.getenv("BINTRAY_PKG_VERSION")
} else {
publishVersion = '0.0.0'
}
desc = 'Capacitor Android Runtime'
website = 'https://github.com/ionic-team/capacitor'
}
Best of luck with this platform.
This is not a direct solution, just a small piece of advise. But from now, please do not use the support library. Recently, Google has been introduced Android JetPack. The current stable version of Android Studio 3.6.1, you will be introduced to AndroidX by default and Google is highly recommended to use it.
AndroidX - Android Extension Library: From AndroidX documentation
You can also migrate from support Android to AndroidX. Just follow this step: Android Studio > Refactor Menu > Migrate to AndroidX. It is independent of the Android SDK version.
From Android Support Revision 28.0.0, you can see that this version will be the last feature release under the android.support packaging and developers are encouraged to migrate to AndroidX 1.0.0. You may face trouble getting support or a solution if you use the support library. So, it will be wise to use AndroidX.
Replace 'variantOutput.getPackageLibrary()' with 'variant.getPackageLibraryProvider()' in your code. It may works.
Option 1:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
instead of
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:appcompat-v4:28.0.0'
Option 2:
Migrate your project to AndroidX

How should I set up RecyclerView version to match my project?

It's been a while I'm trying to run/code a RecyclerView example, with no success though. I guess it has something to do with the RecyclerView version used in dependencies and the Android versions my project is using.
Currently, I'm trying to run this example here.
It doesn't mention what are the compileSdkVersion, minSdkVersion and so on.
Anyway, here's my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.deluxe.example"
minSdkVersion 24
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.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
implementation 'com.squareup.picasso:picasso:2.5.2'
}
Also in this example, the Adapter imports android.support.v7.widget.RecyclerView, for which I get an error: Cannot resolve symbol v7. So, Android suggested importing androidx.recyclerview.widget.RecyclerView;
Issue: my project doesn't load the RecyclerView in the MainActivity - it throws an exception:
Error inflating class android.support.v7.widget.RecyclerView
for which although there're similar questions here and here and here, I couldn't solve my issue.
I'm new to Android Studio, so can anyone suggest what should I change in order to run this Recycler/CardView example? I've tried several examples already, but wasn't able to run any of them - recent and older ones.
I'm trying to run using Android Nougat(7.0) and upper, but it's not mandatory. And my Android Studio version is 3.5.1
Because you're using Androidx (good), then you need to import the corresponding artifacts:
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta04' (or whatever latest version exists)
And then in all the places where you reference RecyclerView, (hint: use Android studio "find" and search for the term recyclerview to find and evaluate all references and places where it's mentioned), and ensure you are referencing the new artifacts, e.g.:
import androidx.recyclerview.widget.RecyclerView in code and
<androidx.recyclerview.widget.RecyclerView ... in XML.
While you are at it, remove
implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
And if you can, replace:
implementation 'com.android.support:cardview-v7:28.0.0'
with:
implementation "com.google.android.material:material:1.1.0-alpha10"
And use:
<com.google.android.material.card.MaterialCardView
in your XMLs.

error: duplicate value for resource 'attr/actionBarSize' with config ''

I'm porting my current android apk to meet recent playstore directive - " targetSdkVersion 26"
This my gradle file. I started off with compileSdkVersion 26 and ended up at 28. So for 28 I had to use AndroidX dependencies. Im stuck at the error as posted in subject line. Any help would be very much appreciated.
The error message is
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/actionBarSize\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/sk/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/34c8fa33903fb2b3203e5c70952da588/res/values/values.xml","position":{"startLine":1303,"startColumn":4,"startOffset":70911,"endColumn":68,"endOffset":70975}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/sk/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/34c8fa33903fb2b3203e5c70952da588/res/values/values.xml","position":{"startLine":1303,"startColumn":4,"startOffset":70911,"endColumn":68,"endOffset":70975}}],"original":"","tool":"AAPT"}
:app:mergeDebugResources
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "pack.age.net"
minSdkVersion 16
//Since no updates to app can be published in Playstore beginning Nov 1, 2018 - bumping targetSdk to 26 from 19
targetSdkVersion 26
//Double check this before you move this to production
versionCode 22
versionName "3.3"
// Enabling multidex support.
multiDexEnabled true
//Language resources
resConfigs "en", "hi"
}
buildTypes {
release {
//Shrink your code
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
//implementation 'com.android.support:support-v4:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
// implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
//Hockey App for Crash Analytics
implementation 'net.hockeyapp.android:HockeySDK:5.1.1'
//Sundry library files
implementation files('libs/commons-codec-1.9.jar')
implementation files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
implementation files('libs/libphonenumber-6.2.jar')
//Mutlidex Support
implementation 'com.android.support:multidex:1.0.0'
//Square Picasso Image View
implementation 'com.squareup.picasso:picasso:2.5.2'
//Calligraphy for custom fonts
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
testImplementation 'junit:junit:4.12'
//Apache Commons
implementation 'org.apache.commons:commons-lang3:3.7'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
// Supports Android 4.0.3 and later (API level 15)
implementation 'com.journeyapps:zxing-android-embedded:2.0.1#aar'
// Supports Android 2.1 and later (API level 7), but not optimal for later Android versions.
// If you only plan on supporting Android 4.0.3 and up, you don't need to include this.
implementation 'com.journeyapps:zxing-android-legacy:2.0.1#aar'
// Convenience library to launch the scanning and encoding Activities.
// It automatically picks the best scanning library from the above two, depending on the
// Android version and what is available.
implementation 'com.journeyapps:zxing-android-integration:2.0.1#aar'
// Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
// This mostly affects encoding, but you should test if you plan to support these versions.
// Older versions e.g. 2.2 may also work if you need support for older Android versions.
implementation 'com.google.zxing:core:3.0.1'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
hello there~ I too got a disaster moving to Androidx... according to google document you should locate the gradle property and add these two lines which works fine for me!
android.enableJetifier=true
android.useAndroidX=true
Good Luck dude~
The proper answer might be, to update the Firebase dependencies to have versions, which already use androidx dependencies and if this should not be enough, to also enable the Jetfier, in case other libraries pull in com.android.support dependencies, which need to be re-written. To do so, add this into the gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true
PS_ANDROIDBUILDTOOLSVERSION=29.0.1
android.aapt2FromMavenOverride=${Android_home}/build-tools/29.0.1/aapt2
disable aapt2 from maven
We need to change XML layout, any support value need to change to androiddx value
android.support.v4.widget.SwipeRefreshLayout need to change to androidx.swiperefreshlayout.widget.SwipeRefreshLayout

After Updating Android studio to 3.1.2 , I get "Failed to load AppCompat ActionBar with unknown error. "

I tried looking other similar questions on stackoverflow, they advice us to changw version of "buildToolsVersion" but I dont see word like that in my gradle file.
My Gradle File (PROJECT):-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My build.gradle (Module:app): This the my second gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.dhruv.testhello"
minSdkVersion 15
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:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
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'
}
I had the same problem. I searched so much and I finally found that appcompat-v7:28.0.0-alpha3 has some bug with "Design View" part of Android Studio.
So I suggest to change com.android.support:appcompat-v7:28.0.0-alpha3 to com.android.support:appcompat-v7:28.0.0-alpha1 version and then click File -> Invalidate Caches / Restart. Volla everything is OK.
Of course you should have internet access to download com.android.support:appcompat-v7:28.0.0-alpha1
I was helped by Hossein Seifi's reply but with a change
implementation 'com.android.support:design:28.0.0-alpha3'
to
implementation 'com.android.support:design:28.0.0-alpha1'
and click File -> Invalidate Caches / Restart
Update 2
As you can see in support 28.0.0 release notes.
This will be the last feature release under the android.support
packaging, and developers are encouraged to migrate to AndroidX 1.0.0
Android will not update support libraries from now. So I suggest you migrate to androidx before they deprecated support libraries.
Update
Support 28.0.0 is released, so you can use this stable version.
implementation 'com.android.support:design:28.0.0'
I suggest never use alpha versions, because alpha, beta versions have bugs, that are testing libraries.
module app gradle file looks like this...In your file you are missing buildToolsVersion, adding this may help you
apply plugin: 'com.android.application'
android {
//changes
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.dhruv.testhello"
minSdkVersion 24
targetSdkVersion 26
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'])
//changes
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.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'
}
In styles.xml,
Changing the theme from Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar has worked for me.
yes its work,
implementation 'com.android.support:design:28.0.0-alpha3'
to
implementation 'com.android.support:design:28.0.0-alpha1'
After that got to File and click -> Invalidate Caches / Restart
At the time of this answer Android Studio 3.1.4 is out with Android Support 28.0.0 Release Candidate(Potential Final, Beta) so please update.
Well, here is a config that will certainly work for you.
targetSdkVersion 28
com.android.support:*:28.0.0-rc01
Where * is the resource type.
Open, res>values>styles.xml, here you will find a line:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
replace the line with:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
That means: Add the word "Base." starting the name of the parent theme.
Open, res --> values --> styles.xml, here you will find a line like this:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
change it to:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
In otherwords, change DarkActionBar to NoActionBar

failed to find style 'cardView Style' in current theme

After updating support library version 27.1.0 Android Studio unable to render CardView. It shows error message as
failed to find style 'cardView Style' in current theme
But no error in compiling and no difference while seeing on the phone.
I have reverted the support library version to 27.0.2 and it's rendering fine.
The issue with support library or Android studio? How to fix this?
App Level Gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.tmmmt.tmmmt"
minSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
buildConfigField 'String', 'FS_CLIENT_ID', FOURSQUARE_CLIENT_ID
buildConfigField 'String', 'FS_CLIENT_SECRET', FOURSQUARE_CLIENT_SECRET
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
buildConfigField 'String', 'FS_CLIENT_ID', FOURSQUARE_CLIENT_ID
buildConfigField 'String', 'FS_CLIENT_SECRET', FOURSQUARE_CLIENT_SECRET
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "default"
productFlavors {
dev {
dimension "default"
versionNameSuffix "-dev"
buildConfigField 'String', 'BASE_URL', BASE_URL_DEV
manifestPlaceholders = [GEO_API_KEY: GOOGLE_MAP_KEY_DEV]
}
beta {
dimension "default"
versionNameSuffix "-beta"
buildConfigField 'String', 'BASE_URL', BASE_URL_BETA
manifestPlaceholders = [GEO_API_KEY: GOOGLE_MAP_KEY_BETA]
}
live {
dimension "default"
buildConfigField 'String', 'BASE_URL', BASE_URL_LIVE
manifestPlaceholders = [GEO_API_KEY: GOOGLE_MAP_KEY_LIVE]
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.anko:anko-common:$anko_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:support-v13:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:cardview-v7:$support_version"
implementation "com.google.firebase:firebase-messaging:$play_version"
implementation "com.google.android.gms:play-services-maps:$play_version"
implementation "com.google.android.gms:play-services-location:$play_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.tmmmt.library:arrowtab:1.3'
implementation 'com.github.stfalcon:chatkit:0.2.2'
implementation 'com.amazonaws:aws-android-sdk-core:2.6.16'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.6.16'
implementation 'com.amazonaws:aws-android-sdk-s3:2.6.16'
implementation 'com.orhanobut:logger:2.1.1'
implementation 'com.tmmmt.library:animations:0.6'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
compile('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
/*Fort*/
implementation project(':FortSDKv1.4.1')
implementation 'com.victor:lib:1.0.1'
implementation 'com.shamanland:fonticon:0.1.8'
implementation('com.nispok:snackbar:2.11.0') {
exclude group: 'com.google.android', module: 'support-v4'
}
implementation 'com.google.guava:guava:23.0-android'
implementation 'org.bouncycastle:bcprov-jdk16:1.46'
implementation 'commons-codec:commons-codec:1.10'
/*Fort*/
}
apply plugin: 'com.google.gms.google-services'
Project Level Gradle:
buildscript {
ext.kotlin_version = '1.2.30'
ext.anko_version = '0.10.1'
ext.support_version = '27.1.0'
ext.play_version = '11.8.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.realm:realm-gradle-plugin:4.3.2"
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://mymavenrepo.com/repo/eDGOo6Dqr4f6uNA0HoWX/"
credentials {
username = 'myMavenRepo'
password = 'tmmmt123'
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update:
There is no such error from Android Studio 3.2. The error was gone completely.
Checking the source of CardView one can see that the constructor
public CardView(#NonNull Context context, #Nullable AttributeSet attrs) {
super(context, attrs);
initialize(context, attrs, 0);
}
has been changed to
public CardView(#NonNull Context context, #Nullable AttributeSet attrs) {
this(context, attrs, R.attr.cardViewStyle);
}
And the new attribute cardViewStyle is defined in the library. I guess that the Android Studio preview is not including the value for this attribute from the library, for some reason. I'm not sure if it usually resolves custom attributes defined in libraries and this is a bug, or if this is intended.
Workaround 1
Resolve the attribute in your theme (maybe only in debug version), this way the error is gone. #style/CardView is already defined in the support library so you don't need to create the style, just reference it.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="cardViewStyle">#style/CardView</item>
</style>
Be sure to use AppTheme in the layout preview and clean build.
Workaround 2
Add the style with tools namespace so that it won't affect your production code. The rendering error will be logged, but you will see the CardView anyway
<android.support.v7.widget.CardView
tools:style="#style/CardView"
...
Good news
Android Studio 3.1 seems to be handling this correctly, no workaround needed (the error in the layout preview is still logged though).
On Android Studio 3.2 (currently in Canary channel) the error is gone.
I also had the same problem, so I added
<item name="cardViewStyle">#style/CardView</item>
in my styles.xml file. But it was showing a warning "The resource #style/CardView is marked as private in com.android.support:design".
So, after that I tried this one
<item name="cardViewStyle">#style/CardView.Light</item>
and this worked for me. I am using Android Studio 3.1.4 and Gradle 4.4.
updating the CardView from 27.1.1 to 28.0.0-alpha3 fixed the XML preview for me on AS 3.1.3.
implementation "com.android.support:cardview-v7:28.0.0-alpha3"
it still complains, but it renders the preview.
there's also a new androidx class now, which should be the same:
implementation "androidx.cardview:cardview:1.0.0"
when updating com.android.support:design to 28.0.0-alpha3, it hints for:
The resource #style/CardView is marked as private in com.android.support:design
downgrading back to API 27 with buildTools 27.0.3 & supportLibrary 27.1.1 also prevents the issues. might upgrade to 28.0.0 with Android Studio 3.2 then.
In my case the reason of the error with CardView was because of the wrong listheader attribute of a child Spinner. Alongside the failed to find style 'cardView Style' in current theme error message I got Spinner adapter view type count must be 1, so the roots of the CardView failing were surprisingly in Spinner rendering failure.

Categories

Resources