我正在尝试在需要 com.android.support:design:23.0.1 的编辑文本中实现 float 标签,但设计支持库未得到编译。
这是我针对应用程序和项目的build.gradle。请指出错误或提出建议。
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.searchable"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:design:22.2.0'
}
PROJECT build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
错误
Error:(24, 13) Failed to resolve: com.android.support:design:22.2.0
我还尝试下载jar文件并将其作为库包含在内。
在这种情况下,编译不会造成任何问题,但是XML文件在生成过程中会返回以下错误。
XMl
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="password" />
</android.support.design.widget.TextInputLayout>
错误
The following class cannot be instantiated -android.support.design.TextInputLayout(Open Class, Show Exception, Clear Cache)
当我单击“打开类”链接时,jar反编译器将显示类源代码,因此我假设您在包含库中没有问题。
编辑
我发现在Gradle中包括任何依赖项都存在问题,并且无论包含的库为何,它都会返回相同的编译错误。
最佳答案
将您的compileSdkVersion更改为23并将其添加到应用程序级别的build.gradle文件中compile 'com.android.support:design:23.4.0'
关于android - 错误夸大设计支持库中的任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37559150/