所以我对android很新,我正在尝试使用Android Studio中的本指南设置Android设计支持库的浮动操作按钮.
我的项目:Noted build.gradle文件:
// 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()
}
}
Run Code Online (Sandbox Code Playgroud)
我的模块:app build.gradle文件:
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'
}
Run Code Online (Sandbox Code Playgroud)
在我的activity_main.xml尝试实施
<android.support.design.widget.FloatingActionButton
... />
Run Code Online (Sandbox Code Playgroud)
但在构建说法后,我得到了一个渲染问题弹出窗口:
找不到以下类:-android.support.design.widget.FloatingActionButton
我的猜测是我的依赖关系做错了,但我真的不知道.我一直试图让这个工作几个小时没有运气,真的很感激任何帮助.
谢谢!
Has*_*sef 10
你需要库设计,在build.gradle文件中添加:
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
Run Code Online (Sandbox Code Playgroud)
然后Sync是Gradle,build和Reresh
我有同样的问题,并使用SDK管理器更新了Android支持存储库","Android支持库"(22.2.1)和"Android SDK工具"(24.1.2),现在它正常工作.一旦更新完成重建项目.更多https://developer.android.com/tools/support-library/setup.html
| 归档时间: |
|
| 查看次数: |
24903 次 |
| 最近记录: |