android - 错误夸大设计支持库中的任何内容

标签 android xml gradle build.gradle

我正在尝试在需要 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/

相关文章:

Android 在录制视频时使用 ffmpeg 编码视频

java - 如何使用 Square 的改造将多维哈希作为查询参数传递

android - 如何删除 ksoap 中的命名空间声明?

eclipse - eclipse项目Android studio中没有gradle文件

java - 数组查询,索引越界

android - CrystalRangeSeekbar 未反射(reflect)新值

c# - 在控制生成的 XML 元素的同时对派生类使用 C# xmlserializer

java - 运行 run 目标时出现 Ant 构建错误

cordova - 如何在Cordova中禁用Gradle守护程序

android - Gradle - "enforceUniquePackageName"版本 3.0.0+ 已弃用?