我正在从http://developer.android.com/training/basics/firstapp/starting-activity.html开始执行Android first app
教程。
我正在尝试使用FloatingActionButton
,但Android Studio无法识别它。
我添加了这个导入:
import android.support.design.widget.FloatingActionButton;
但它也没有找到。
我是否需要添加任何其他依赖项?
如果我将compile 'com.android.support:design:23.2.1'
添加到模块的build.gradle
,我会得到:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:design:23.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/design/23.2.1/design-23.2.1.pom
https://jcenter.bintray.com/com/android/support/design/23.2.1/design-23.2.1.jar
file:/Users/octavian/Library/Android/sdk/extras/android/m2repository/com/android/support/design/23.2.1/design-23.2.1.pom
file:/Users/octavian/Library/Android/sdk/extras/android/m2repository/com/android/support/design/23.2.1/design-23.2.1.jar
file:/Users/octavian/Library/Android/sdk/extras/google/m2repository/com/android/support/design/23.2.1/design-23.2.1.pom
file:/Users/octavian/Library/Android/sdk/extras/google/m2repository/com/android/support/design/23.2.1/design-23.2.1.jar
Required by:
MyFirstApp:app:unspecified
答案 0 :(得分:0)
添加您的gradle支持设计库
compile 'com.android.support:design:23.2.1'
答案 1 :(得分:0)
您可以使用其中一个
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:design:23.1.1'
版本23.2越野车。查看详情 Android Studio FloatingActionButton error
答案 2 :(得分:0)
添加:
dependencies {
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
}