zoukankan      html  css  js  c++  java
  • build.gradle

    好久没有写代码,竟然连butterknife怎么配置都配置不好了。不过,我的自信还是有的,因为我以前弄成功过,所以,我弄不出来也不怎么心急,因为我知道我一定可以弄出来的。

    今天的坑就是删除了一行代码,结果一直告诉我:

    Error:Could not find com.jakewharton:butterknife-compiler:8.0.1.
    Searched in the following locations:
        file:/D:/software/android-studio-2.1/android-studio/gradle/m2repository/com/jakewharton/butterknife-compiler/8.0.1/butterknife-compiler-8.0.1.pom
        file:/D:/software/android-studio-2.1/android-studio/gradle/m2repository/com/jakewharton/butterknife-compiler/8.0.1/butterknife-compiler-8.0.1.jar
        file:/D:/software/androidsdk20140708/android-sdk/extras/android/m2repository/com/jakewharton/butterknife-compiler/8.0.1/butterknife-compiler-8.0.1.pom
        file:/D:/software/androidsdk20140708/android-sdk/extras/android/m2repository/com/jakewharton/butterknife-compiler/8.0.1/butterknife-compiler-8.0.1.jar
        file:/D:/software/androidsdk20140708/android-sdk/extras/google/m2repository/com/jakewharton/butterknife-compiler/8.0.1/butterknife-compiler-8.0.1.pom
        file:/D:/software/androidsdk20140708/android-sdk/extras/google/m2repository/com/jakewharton/butterknife-compiler/8.0.1/butterknife-compiler-8.0.1.jar
    Required by:
        MyApplication:app:unspecified

    就是因为我的全局的gradle被我删除了这段代码:

    allprojects {
        repositories {
            jcenter()
        }
    }


    butterknife的配置应该如下:

    //butternife
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        }
    }
    apply plugin: 'com.neenbedankt.android-apt'
    
    dependencies {  
      compile 'com.jakewharton:butterknife:8.0.1'  
      apt 'com.jakewharton:butterknife-compiler:8.0.1'  
    }  

    这个应该是在自己的app.build.gradle里面配置。
    完整的来一个:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 24
        buildToolsVersion "23.0.3"
    
        defaultConfig {
            applicationId "cebactivity.chinaceb.com.myapplication"
            minSdkVersion 11
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    //butternife
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        }
    }
    
    apply plugin: 'com.neenbedankt.android-apt'
    
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.jakewharton:butterknife:8.0.1'
        apt 'com.jakewharton:butterknife-compiler:8.0.1'
        compile 'com.android.support:appcompat-v7:24.0.0'
    }
    


    因为今天这个错误,我才知道jcenter是一个什么东西。原来是一个仓库。里面有所有的网上代码,如果你不写这一句代码,那么他只会在本地找,然后找不到,

    allprojects {
        repositories {
            jcenter()
        }
    }
  • 相关阅读:
    4种xml解析器区别
    eclipse的快捷键(常用)
    eclipse修改项目访问前缀
    oracle创建用户
    导入安全证书到jdk
    laravel 命令行输出进度条
    sql 事务的四种隔离级别
    supervisor 通过图形界面管理
    supervisor "INFO spawnerr: unknown error making dispatchers for xxx" 错误
    linux expect 的使用
  • 原文地址:https://www.cnblogs.com/caoxinyu/p/6647835.html
Copyright © 2011-2022 走看看