导入库android studio

时间:2015-09-16 16:06:07

标签: android android-studio build.gradle android-library

嘿伙计们我一直试图在Android工作室上导入这个库我只是不能这样做。有人可以指导我导入这个库。

链接:https://github.com/rey5137/material

application gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app:gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.projects.jeet.materialUI"
        minSdkVersion 15
        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.0.0'
    compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:cardview-v7:22.2.1'
}

现在我在我的values-v23.xml中出现错误

<resources>
    <!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/values-v23/styles_base_text.xml -->
    <eat-comment/>
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Inverse" parent="android:TextAppearance.Material.Widget.Button.Inverse"/>
    <!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/values-v23/themes_base.xml -->
    <eat-comment/>
    <style name="Base.Theme.AppCompat" parent="Base.V23.Theme.AppCompat"/>
    <style name="Base.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light"/>
    <style name="Base.V23.Theme.AppCompat" parent="Base.V22.Theme.AppCompat">
        <!-- We can use the platform drawable on v23+ -->
        <item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>

        <item name="controlBackground">@drawable/abc_control_background_material</item>
    </style>
    <style name="Base.V23.Theme.AppCompat.Light" parent="Base.V22.Theme.AppCompat.Light">
        <!-- We can use the platform drawable on v23+ -->
        <item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>

        <item name="controlBackground">@drawable/abc_control_background_material</item>
    </style>
    <!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/values-v23/styles_base.xml -->
    <eat-comment/>
    <style name="Base.Widget.AppCompat.Button.Colored" parent="android:Widget.Material.Button.Colored"/>
</resources>

错误是

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\AndroidDevKit\sdk\build-tools\23.0.0\aapt.exe'' finished with non-zero exit value 1

2 个答案:

答案 0 :(得分:1)

如回购协议中所述,将此依赖关系添加到build.gradle

dependencies {
   compile 'com.github.rey5137:material:1.2.1'
}

答案 1 :(得分:1)

将此依赖项添加到应用程序文件夹中的build.grade:

repositories {
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}

将这些依赖项添加到app文件夹中的build.grade:

dependencies {
   compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
   compile 'com.android.support:appcompat-v7:22.2.1'
   compile 'com.android.support:cardview-v7:22.2.1'
}