Android注释生成的类没有出现

时间:2017-01-12 00:29:20

标签: android gradle apt android-annotations

这是我的build.gradle

apply plugin: 'com.android.library'
apply plugin: 'android-apt'
def AAVersion = '4.2.0'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        debug {
            minifyEnabled false
            buildConfigField "String", "API_BASE_URL", '"http://artemis.apolotechnologies.com:8080"'
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "API_BASE_URL", '"http://artemis.apolotechnologies.com:8080"'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:recyclerview-v7:25.1.0'
    testCompile 'junit:junit:4.12'

    compile 'com.squareup.retrofit2:retrofit:2.2.0-SNAPSHOT'
    compile 'io.reactivex.rxjava2:rxjava:2.0.4'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'com.squareup.retrofit2:converter-jackson:2.2.0-SNAPSHOT'
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0-SNAPSHOT'
    compile 'com.squareup.retrofit2:retrofit-mock:2.2.0-SNAPSHOT'

    compile 'com.orhanobut:logger:1.15'
    compile 'com.afollestad:sectioned-recyclerview:0.2.3'
    compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '8.0.0'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile 'org.parceler:parceler-api:1.1.6'
    apt 'org.parceler:parceler:1.1.6'
}

apt {
    arguments {
        library 'true'
        logLevel 'trace'
        logAppenderConsole 'true'
        resourcePackageName "com.apolotechnologies.appolocommon"
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }
}

类在build / generated / source / apt / release中,但是生成的类没有出现在android studio中,我无法使用它们,project是一个库,我正在尝试使用另一个项目补充:

sourceSets {
    apt{
        java{
            srcDir 'build/generated/source/apt/release'
        }
    }
}

没有运气

这是我的androidannotations.log

18:28:44.389 [Daemon worker Thread 63] INFO  o.a.i.AndroidAnnotationProcessor:88 - Initialize AndroidAnnotations 4.2.0 with options {library=true, logLevel=trace, resourcePackageName=com.apolotechnologies.appolocommon, androidManifestFile=/Users/cristiangomez/dev/apolo/android/appolo-android-rider/appolo-android-common/build/intermediates/manifests/aapt/release/AndroidManifest.xml}
18:28:44.405 [Daemon worker Thread 63] INFO  o.a.i.AndroidAnnotationProcessor:108 - Plugins loaded: []
18:28:45.8 [Daemon worker Thread 63] TRACE o.a.i.AndroidAnnotationProcessor:119 - Start processing for 7 annotations [org.androidannotations.annotations.AfterViews, org.androidannotations.annotations.EActivity, org.androidannotations.annotations.EFragment, org.androidannotations.annotations.ViewById, org.androidannotations.annotations.res.StringRes, org.androidannotations.annotations.InstanceState, org.androidannotations.annotations.Click] on 39 elements [com.apolotechnologies.appolocommon.activity.adapter.CountryAdapter, com.apolotechnologies.appolocommon.activity.CountryPickerActivity, com.apolotechnologies.appolocommon.activity.fragment.CountryPickerFragment, com.apolotechnologies.appolocommon.activity.fragment.EmailInputFragment, com.apolotechnologies.appolocommon.activity.fragment.NameInputFragment, com.apolotechnologies.appolocommon.activity.fragment.PasswordInputFragment, com.apolotechnologies.appolocommon.activity.fragment.PhoneConfirmationCodeFragment, com.apolotechnologies.appolocommon.activity.fragment.PhoneInputFragment, com.apolotechnologies.appolocommon.activity.fragment.PhoneNumberFragment, com.apolotechnologies.appolocommon.activity.RegisterActivity, com.apolotechnologies.appolocommon.activity.transition.PhoneInputTransition, com.apolotechnologies.appolocommon.Appolo, com.apolotechnologies.appolocommon.interactor.RegisterInteractor, com.apolotechnologies.appolocommon.interactor.retrofit.RegisterInteractorImpl, com.apolotechnologies.appolocommon.model.Country, com.apolotechnologies.appolocommon.model.CountrySection, com.apolotechnologies.appolocommon.model.Section, com.apolotechnologies.appolocommon.model.User, com.apolotechnologies.appolocommon.network.ApiService, com.apolotechnologies.appolocommon.network.ApiServiceFactory, com.apolotechnologies.appolocommon.network.pojo.BaseResponse, com.apolotechnologies.appolocommon.network.pojo.UserResponse, com.apolotechnologies.appolocommon.service.ConfirmationCodeTimerBroadcastService, com.apolotechnologies.appolocommon.Util, android.support.compat.R, android.support.coreui.R, android.support.coreutils.R, android.support.fragment.R, android.support.graphics.drawable.animated.R, android.support.graphics.drawable.R, android.support.mediacompat.R, android.support.v4.R, android.support.v7.appcompat.R, android.support.v7.recyclerview.R, com.afollestad.sectionedrecyclerview.R, com.apolotechnologies.appolocommon.R, com.orhanobut.logger.R, io.reactivex.android.R, com.apolotechnologies.appolocommon.BuildConfig]
18:28:45.23 [Daemon worker Thread 63] DEBUG o.a.i.h.AndroidManifestFinder:114 - AndroidManifest.xml file found with specified path: /Users/cristiangomez/dev/apolo/android/appolo-android-rider/appolo-android-common/build/intermediates/manifests/aapt/release/AndroidManifest.xml
18:28:45.35 [Daemon worker Thread 63] INFO  o.a.i.AndroidAnnotationProcessor:164 - AndroidManifest.xml found: AndroidManifest [applicationPackage=com.apolotechnologies.appolocommon, componentQualifiedNames=[], metaDataQualifiedNames={}, permissionQualifiedNames=[], applicationClassName=, libraryProject=true, debugabble=false, minSdkVersion=15, maxSdkVersion=-1, targetSdkVersion=25]
18:28:45.38 [Daemon worker Thread 63] INFO  o.a.i.r.ProjectRClassFinder:51 - Found project R class: com.apolotechnologies.appolocommon.R
18:28:45.51 [Daemon worker Thread 63] INFO  o.a.i.r.AndroidRClassFinder:45 - Found Android class: android.R
18:28:45.69 [Daemon worker Thread 63] INFO  o.a.i.p.ModelValidator:46 - Validating elements
18:28:45.70 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with EActivityHandler: [com.apolotechnologies.appolocommon.activity.RegisterActivity]
18:28:45.86 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with EFragmentHandler: [com.apolotechnologies.appolocommon.activity.fragment.PhoneInputFragment]
18:28:45.90 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with ViewByIdHandler: [countryFlagImageView, countryCallingCodeTextView, phoneInputEditText, toolbar]
18:28:45.98 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with ClickHandler: [onNext(), onCountrySelect()]
18:28:45.106 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with DefaultResHandler: [userType]
18:28:45.109 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with InstanceStateHandler: [selectedCountry, phoneNumber, email, firstName, lastName, password, confirmationCode]
18:28:45.119 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelValidator:69 - Validating with AfterViewsHandler: [initViews(), initViews()]
18:28:45.148 [Daemon worker Thread 63] INFO  o.a.i.p.ModelProcessor:67 - Processing root elements
18:28:45.149 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelProcessor:180 - Processing root elements EActivityHandler: [com.apolotechnologies.appolocommon.activity.RegisterActivity]
18:28:45.233 [Daemon worker Thread 63] DEBUG o.a.i.p.ModelProcessor:180 - Processing root elements EFragmentHandler: [com.apolotechnologies.appolocommon.activity.fragment.PhoneInputFragment]
18:28:45.240 [Daemon worker Thread 63] INFO  o.a.i.p.ModelProcessor:79 - Processing enclosed elements
18:28:45.270 [Daemon worker Thread 63] INFO  o.a.i.AndroidAnnotationProcessor:231 - Number of files generated by AndroidAnnotations: 2
18:28:45.271 [Daemon worker Thread 63] DEBUG o.a.i.g.SourceCodeWriter:57 - Generating class: com.apolotechnologies.appolocommon.activity.fragment.PhoneInputFragment_
18:28:45.313 [Daemon worker Thread 63] DEBUG o.a.i.g.SourceCodeWriter:57 - Generating class: com.apolotechnologies.appolocommon.activity.RegisterActivity_
18:28:45.348 [Daemon worker Thread 63] INFO  o.a.i.p.TimeStats:81 - Time measurements: [Whole Processing = 340 ms], [Process Annotations = 150 ms], [Generate Sources = 77 ms], [Validate Annotations = 52 ms], [Find R Classes = 31 ms], [Extract Manifest = 12 ms], [Extract Annotations = 3 ms], 
18:28:45.348 [Daemon worker Thread 63] INFO  o.a.i.AndroidAnnotationProcessor:137 - Finish processing

这是我的项目(使用库的那个)build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.apolotechnologies.appolorider"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    testCompile 'junit:junit:4.12'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile 'org.parceler:parceler-api:1.1.6'
    apt 'org.parceler:parceler:1.1.6'
    compile project(":appolo-android-common")
}

这是我的主要build.gradle

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

buildscript {
    repositories {
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0-beta2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

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

allprojects {
    repositories {
        jcenter()
        maven {url "https://oss.sonatype.org/content/repositories/snapshots/"}
        maven {url "https://clojars.org/repo/"}
        mavenLocal()
    }
}

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

0 个答案:

没有答案