Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了让Android Studio,Gradle和Android Annotations协同工作大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
既然我决定在 Android studio中使用Android Annotations,我想通过Gradle实现它.经过一些深思熟虑的研究后,我发现有更旧的方法可以通过Gradle实现Android Annotations,具体取决于android studio,gradle或android注释的版本.我来到这个有用的教程 – > http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/,并试图实现这一点,首先,用新的’android-L’作为目标SDK之类的

直到我试着用它

并且

每次我得到2个警告,我的java类似乎没有得到预编译.即使它似乎预先创建了build / generated / source / apt目录.但没有我的MainActivity预处理类 – >主要活动_

我总是得到以下警告:

我的build.gradle文件如下所示:

buildscript{
repositories{
    mavenCentral()
}

dependencies{
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3'
    }
}


repositories{
    mavenCentral()
}

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

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "at.gradle.defuex.gradletest"
        minSdkVersion 10
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }

    signingConfigs{
        releaseConfig{
            storeFile file("gradlekeystore.jks");
            storepassword ("*************");
            keyAlias "keyAlias";
            keypassword "*************";
        }
    }


    buildTypes {
        release {
            runProguard false
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'

            signingConfig signingConfigs.releaseConfig
        }

        debug {
            debuggable true
            applicationIdSuffix ".debug"
        }
    }
}

apt {
    arguments {
        androidManifestFile variant.processresources.manifestFile
        resourcePackagename "at.gradle.defuex.gradletest"
    }
}

dependencies {
    apt "org.androidAnnotations:androidAnnotations:3.0+"
    compile "org.androidAnnotations:androidAnnotations-api:3.0+"
    compile fileTree(dir: 'libs',include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
}

我使用以下版本:

> Android studio版本0.8.2
> Gradle版本0.12.2
> android-apt版本1.3
> android Annotations版本3.0.1(如build.gradle文件中所示)

,但我更喜欢解决我的问题:)

干杯!

解决方法

尝试从项目根目录运行gradlew clean build. 然后在设备上运行之前尝试制作项目(带有绿色箭头0和1的按钮).应该没事.

大佬总结

以上是大佬教程为你收集整理的让Android Studio,Gradle和Android Annotations协同工作全部内容,希望文章能够帮你解决让Android Studio,Gradle和Android Annotations协同工作所遇到的程序开发问题。

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

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