Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android Gradle插件0.13和android-apt 1.3出错大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚将我的 @L_403_0@ gradle插件从0.12更新到0.13.此外,我已经下载了gradle 2.1.然后,我尝试使用android studio 0.8.9测试版,但根据 http://tools.android.com/tech-docs/new-build-system/version-compatibility,我必须使用至少android studio 0.8.11(金丝雀频道).所以我已经更新了我的android工作室,但我仍然有问题.

现在,我必须使用gradle 1.10和android gradle插件0.12.上班

来自AS的错误

错误:没有这样的属性:类的projectDependencies:com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated

编辑:

这是我的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        // works with 0.12.+ (not with 0.13.+)
        classpath 'com.android.tools.build:gradle:0.12.+'

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

        // The latest version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3'
    }
}

allprojects {
    repositories {
        maven {  // For Android-ViewPagerInDicator
            url "http://dl.bintray.com/populov/maven"
        }
        jcenter()
        mavenCentral()
        maven {
            url "http://JRAF.org/static/maven/2"
        }
    }
}

这是我的gradle-wrapper.properties

#Fri Sep 19 17:50:42 CEST 2014
diStributionBase=GRADLE_user_HOME
diStributionPath=wrapper/dists
zipStoreBase=GRADLE_user_HOME
zipStorePath=wrapper/dists
# use gradle-2.1-all.zip with android gradle plugin 0.13
diStributionUrl=http\://services.gradle.org/diStributions/gradle-1.10-all.zip

编辑2:

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId 'xxx'
        minSdkVersion 10
        targetSdkVersion 19
        versionCode xxx
        versionName 'xxx'
    }

    // For more information see
    // @link http://tools.android.com/tech-docs/new-build-sy@L_675_11@/user-guide#TOC-Using-sourceCompatibility-1.7
    compiLeoptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    signingConfigs {
        debug {
            storeFile file('../../KeyStore/debug.keystore')
            storepassword 'android'
            keyAlias 'androiddebugkey'
            keypassword 'android'
        }
        release {
            storeFile file('xxx')
            storepassword 'xxx'
            keyAlias 'xxx'
            keypassword 'xxx'
        }
    }

    buildTypes {
        // Just intern. This is alpha build
        debug {
            buildConfigField "Boolean","FORCE_GOOG_GEO_API","false"  // can be set to true in debug but not in other buildTypes
            buildConfigField "Boolean","ENABLE_LOG","true"
            buildConfigField "String","HOST","\"xxx\""
            versionNameSuffix '-alpha'
            signingConfig signingConfigs.debug
            zipAlign true
        }
        // For customer
        reCETte {
            buildConfigField "Boolean","false"
            buildConfigField "Boolean","false"
            buildConfigField "String","\"xxx\""
            versionNameSuffix '-reCETte'
            signingConfig signingConfigs.debug
            zipAlign true
        }
        // PreProd
        preprod {
            buildConfigField "Boolean","\"xxx\""
            signingConfig signingConfigs.debug
            zipAlign true
        }
        // Prod
        release {
            buildConfigField "Boolean","\"xxx\""
            signingConfig signingConfigs.release
            zipAlign true
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-project.txt'
        }
    }

    // This is important,it will run lint checks but won't abort build
    lintOptions {
        abortOnError false
        disable 'MissingTranslation'
    }

    packagingOptions {
        exclude 'Meta-INF/DEPENDENCIES'
        exclude 'Meta-INF/NOTICE'
        exclude 'Meta-INF/LICENSE'
        exclude 'Meta-INF/LICENSE.txt'
        exclude 'Meta-INF/NOTICE.txt'
        exclude 'AndroidManifest.xml'
    }
}

apt {
    arguments {
        resourcePackagename android.defaultConfig.packagename
        androidManifestFile variant.processresources.manifestFile
    }
}

def GoogPlayServVersion = '5.0.+';
def GsonVersion = '2.2.4';
def LibPhonenumbVersion = '5.9';
def GreenRobotVersion = '2.2.1';
def OkhttpVersion = '2.0.0';
def OkhttpConnVersion = '2.0.0';
def JacksonCore = '2.4.1';
def JacksonDatabind = '2.4.1';
def JacksonAnnotations = '2.4.0';
def SwitchVersion = '1.3.1';
def CroutonVersion = '1.8.4';
def ActionBarSherlockVersion = '4.4.0';
def ViewpagerInDicatorVersion = '2.4.1';
def PiCassoVersion = '2.3.4';
def RoboSpiceVersion = '1.4.12';
def StickyListHeaders = '2.4.1';
def AAVersion = '3.1';

def RobotiumVersion = '5.2.1';

dependencies {
    // Include all jar in libs folder
    compile fileTree(dir: 'libs',include: ['*.jar'])

    // Google Play services
    compile "com.google.android.gms:play-services:$GoogPlayServVersion"

    // Gson
    compile "com.google.code.gson:gson:$GsonVersion"

    // Libphonenumber
    compile "com.googlecode.libphonenumber:libphonenumber:$LibPhonenumbVersion"

    // GreenRobot
    compile "de.greenrobot:eventbus:$GreenRobotVersion"

    // Okhttp [We use repackaged version @see https://github.com/square/okhttp/issues/967]
    // compile "com.squareup.okhttp:okhttp:$OkhttpVersion"
    // compile "com.squareup.okhttp:okhttp-urlconnection:$OkhttpConnVersion"

    // Jackson
    compile "com.fasterxml.jackson.core:jackson-core:$JacksonCore"
    compile "com.fasterxml.jackson.core:jackson-databind:$JacksonDatabind"
    compile "com.fasterxml.jackson.core:jackson-Annotations:$JacksonAnnotations"

    // Switch BACkport
    compile "org.jraf:android-switch-BACkport:$SwitchVersion"

    // Crouton lib
    compile("de.keyboardsurfer.android.widget:crouton:$CroutonVersion") {
        // exclusion is not neccessary,but generally a good idea.
        exclude group: 'com.google.android',module: 'support-v4'
    }

    // You must install or update the Support Repository through the SDK manager to use this dependency.
    // The Support Repository (separate from the corresponding library) can be found in the Extras category.
    // compile 'com.android.support:support-v4:19.1.0'
    // compile 'com.android.support:gridlayout-v7:19.1.0'

    // ActionBarSherlock
    compile "com.actionbarsherlock:actionbarsherlock:$ActionBarSherlockVersion@aar"

    // Android-ViewPagerInDicator
    compile "com.viewpagerinDicator:library:$ViewpagerInDicatorVersion@aar"

    // PiCasso
    compile "com.squareup.piCasso:piCasso:$PiCassoVersion"

    // Robospice
    compile "com.octo.android.robospice:robospice:$RoboSpiceVersion"

    // StickyList headers
    compile "se.emilsjolander:stickylistheaders:$StickyListHeaders"

    // Facebook sdk
    compile 'fr.avianey:facebook-android-api:+@aar'

    // android Annotations
    compile "org.androidAnnotations:androidAnnotations-api:$AAVersion"
    apt "org.androidAnnotations:androidAnnotations:$AAVersion"

    compile 'com.sothree.slidinguppanel:library:+'

    // Tests part
    androidTESTCompile "com.jayway.android.robotium:robotium-solo:$RobotiumVersion"
    compile "com.jayway.android.robotium:robotium-solo:$RobotiumVersion"
}

你知道我怎么解决这个问题?

谢谢

解决方法

android-apt 1.3似乎与Android Gradle插件的v0.13不兼容.请改用android-apt 1.4:
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.13.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'

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

大佬总结

以上是大佬教程为你收集整理的Android Gradle插件0.13和android-apt 1.3出错全部内容,希望文章能够帮你解决Android Gradle插件0.13和android-apt 1.3出错所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。