So I am pretty new to android and I am trying to setup a floating action button with the Android Design Support Library using this guide in Android Studio.
My Project: Noted build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
My Module: app build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.noted"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:design:22.2.0'
}
In myactivity_main.xml
I try to implement
<android.support.design.widget.FloatingActionButton
... />
but I get one of those Rendering Problems pop ups after building saying:
The following classes could not be found: -android.support.design.widget.FloatingActionButton
My guess is that I'm doing something wrong with my dependencies but I really have no idea. I have been trying to get this to work for hours with no luck and would really appreciate any help.
Thanks!
I have been facing this problem recently and tried to change dependencies version, invalidating caches and restart, etc. The preview rendered once and then reopening my xml file, it raised the same error.
Clicking on the refresh button at the preview window solved to me (momentarily) the problem, letting me see the layout and its elements properly.
I had the same issue and updated the Android Support Repository", "Android Support Library"(22.2.1) and "Android SDK Tool"(24.1.2) using SDK manager now its working fine. Once update finish rebuild the project. For more https://developer.android.com/tools/support-library/setup.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With