4

Android Studio 1.0.0 を使用しています。バターナイフの依存関係を追加しようとしています。

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.google.android.gms:play-services:6.1.11'
compile 'com.android.support:recyclerview-v7:21.0.2'
}

しかし、次のGradleエラーが発生しています:

エラー: 見つかりませんでした: com.jakewharton:butterknife:6.0.0

4

4 に答える 4

4

私は同じ問題を抱えていました!最後に、プロジェクトをクリーンアップしようとすると、より具体的なグラドル エラーが発生しました。したがって、問題はgradleオフラインモードが有効になっていることでした! 設定 -> Gradle -> Offline work ...のチェックを外すだけです。

于 2014-12-30T21:35:58.820 に答える
0

で試してみましたがbuild.gradle、動作します。

ルートbuild.gradle。ビルドスクリプトの外に置いてみるとrepositories { mavenCentral() }、うまくいくでしょう。

編集

アプリのbuild.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    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:21.0.2'
    compile 'com.jakewharton:butterknife:6.0.0'
}

ルートの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.0.0-rc4'

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

allprojects {
    repositories {
        jcenter()
    }
}

settings.gradle

include ':app'
于 2014-12-15T18:38:49.223 に答える