Maven的+生成AndroidAnnotations但不可到达班(Maven + AndroidAnnotations generated but not reachable classes)

Android IT屋

Alright.

I'm attempting to create a project which is perfectly build able by using maven, and maven only.

Currently I'm facing this issue of classes being generated, and working fine, as long as there is no reference in actual java code.

Meaning, that if I create an example as in the documentation it works.

As soon as I do something like

Intent i = new Intent(SettingsActivity_);

then the build fails with

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project InterestingFind: Compilation failure cannot find symbol

cannot find symbol
symbol:   variable DerpActivity_
location: class be.company.android.DisplayMapActivity

The files however, do get generated, as you can see in the image attached, but when the project is looked at in en Eclipse view, they are solely seen as normal folders, and not as 'source folder'.

This might explain why they are not picked up, but gives me a bit of a headache. I cloned an android archetype, the release build.

Please, be of assistance if you in some way think you can aid me with this problem!Project structure

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0


    be.idamediafoundry
    InterestingFind-parent
    1.0-SNAPSHOT


be.idamediafoundry
InterestingFind
1.0-SNAPSHOT
apk
InterestingFind - Application

    3.0-SNAPSHOT



    
        snapshots-repository
        Sonatype oss snapshot repo
        https://oss.sonatype.org/content/repositories/snapshots
    


    
        com.google.android
        android
    
    
        de.akquinet.android.androlog
        androlog
    
    
    
         org.codehaus.jackson
        jackson-mapper-asl
        1.9.5
    
    
    
        org.androidannotations
        androidannotations
        ${androidannotations.version}
        provided
    
    
        org.androidannotations
        androidannotations-api
        ${androidannotations.version}
    

    
    
        org.springframework.android
        spring-android-rest-template
        ${spring-android-version}
    

    
    
        com.google.android.gms
        google-play-services
        5
        apklib
    



    


        
        com.jayway.maven.plugins.android.generation2
        android-maven-plugin
        3.5.1
        true
        true
        
            ${project.basedir}/AndroidManifest.xml
            ${project.basedir}/assets
            ${project.basedir}/res
            ${project.basedir}/src/main/native
            
                15
            
            true
        
    

        
            versions-maven-plugin
            org.codehaus.mojo
            2.0
        

        
            org.apache.maven.plugins
            maven-eclipse-plugin
            2.9
            
                
                    com.android.ide.eclipse.adt.AndroidNature
                    org.eclipse.jdt.core.javanature
                
            
        
    



    
        release
        
            
                
                    com.pyx4me
                    proguard-maven-plugin
                    
                        
                            process-classes-with-proguard
                            process-classes
                            
                                proguard
                            
                            
                                4.4
                                256m
                                classes
                                
                                    ${rt.jar.path}
                                    ${jsse.jar.path}
                                
                                true
                                false
                                ${project.basedir}/proguard.conf
                            
                        
                    
                    
                        
                            net.sf.proguard
                            proguard
                            4.4
                            runtime
                        
                    
                
                
                    maven-jarsigner-plugin
                    
                        
                            sign-application-apk
                            package
                            
                                sign
                                verify
                            
                        
                    
                
                
                    com.jayway.maven.plugins.android.generation2
                    android-maven-plugin
                    
                        
                            zipalign-application-apk
                            package
                            
                                zipalign
                            
                        
                    
                    
                        true
                        
                            true
                            ${project.build.directory}/${project.artifactId}-${project.version}.apk
                            ${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk
                        
                        
                            false
                        
                    
                
                
                    org.codehaus.mojo
                    build-helper-maven-plugin

                    
                        
                            
                                ${project.build.directory}/proguard_map.txt
                                map
                                release
                            
                        
                    
                    
                        
                            attach-signed-aligned
                            package
                            
                                attach-artifact
                            
                        
                        
                            generate-sources
                            
                                add-source
                            
                            
                                
                                    ${project.basedir}/target/generated-sources/annotations
                                
                            
                        
                    
                
            
        
    

Parent Pom :

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0

be.idamediafoundry
InterestingFind-parent
1.0-SNAPSHOT
pom
InterestingFind - Parent


    InterestingFind
    InterestingFind-it



    4.1.1.4
    3.5.1
    1.0.1.RELEASE
    ${project.basedir}/my-release-key.keystore
    
    
    
    
    
    




    
        codehaus-snapshots
        http://snapshots.repository.codehaus.org
    




    

        
            com.jayway.maven.plugins.android.generation2
            android-maven-plugin
            3.5.1
        
        
            com.google.android
            android
            ${platform.version}
            provided
        
        
            com.google.android
            android-test
            ${platform.version}
            provided
        

        
        
            de.akquinet.android.androlog
            androlog
            1.0.5
        

        
            junit
            junit
            4.10
            provided
        

    





    
        

            
                com.jayway.maven.plugins.android.generation2
                android-maven-plugin
                3.5.1
                true
                
                    ${project.basedir}/AndroidManifest.xml
                    ${project.basedir}/assets
                    ${project.basedir}/res
                    ${project.basedir}/src/main/native
                    
                        15
                    
                    true
                
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                3.0
                
                    1.6
                    1.6
                
                true
            
            
                maven-enforcer-plugin
                1.0
            
            
                maven-release-plugin
                2.1
                
                    true
                
            
            
                maven-jarsigner-plugin
                1.2
                true
                
                    true
                    
                    ${project.build.directory}/${project.build.finalName}.${project.packaging}
                    true
                    true
                    ${sign.keystore}
                    ${sign.alias}
                    ${sign.storepass}
                    ${sign.keypass}
                
            
            
                com.pyx4me
                proguard-maven-plugin
                2.0.4
                
                    
                        net.sf.proguard
                        proguard
                        4.4
                        runtime
                    
                
                
                    4.4
                
            
        
    



    
        release
        
            
                performRelease
                true
            
        
        
            
                
                    com.jayway.maven.plugins.android.generation2
                    android-maven-plugin
                    ${android-plugin}
                    
                        true
                    
                

                
                    maven-enforcer-plugin
                    
                        
                            enforce-signing-properties
                            
                                enforce
                            
                            
                                
                                    
                                        sign.keystore
                                        The 'sign.keystore' property is missing. It must
                                            contain the path to the
                                            keystore used to sign the
                                            application.
                                        
                                    
                                    
                                        
                                            ${sign.keystore}
                                        
                                        The 'sign.keystore' property does not point to a
                                            file. It must contain the
                                            path to the keystore used to sign
                                            the application.
                                        
                                    
                                    
                                        sign.alias
                                        The 'sign.alias' property is missing. It must
                                            contain the key alias used to
                                            sign the application.
                                        
                                    
                                    
                                        sign.storepass
                                        The 'sign.storepass' property is missing. It must
                                            contain the password of
                                            the keystore used to sign the
                                            application.
                                        
                                    
                                    
                                        sign.keypass
                                        The 'sign.keypass' property is missing. It must
                                            contain the password of the
                                            key used to sign the application.
                                        
                                    
                                
                            
                        
                    
                
            
        
    
    
        linux
        
            
                unix
            
        
        
            ${java.home}/jre/lib/rt.jar
            ${java.home}/jre/lib/jsse.jar
        
    
    
    
        mac
        
            
                mac
            
        
        
            
            
            
            ${java.home}/../Classes/classes.jar
            ${java.home}/../Classes/jsse.jar
        
    
    
        windows
        
            
                windows
            
        
        
            ${java.home}/jre/lib/rt.jar
            ${java.home}/jre/lib/jsse.jar
        
    

Edit : updated pom. Edit : uploaded Log file

解决方案

Seems the problem was caused by a dependency not being resolved.

At first Maven did not even report this missing dependency, until I started removing things from my pom which I had added in an attempt to resolve this issue.

Now, what explains that the dependency didn't get auto-resolved, is the fact that there is no such artifact on the central maven repository.

As such, I added the following repository :


    
    
        android-rome-feed-reader-repository
        Android ROME Feed Reader Repository
        https://android-rome-feed-reader.googlecode.com/svn/maven2/releases
    

Resulting in that 'hidden' dependency being resolved.

This dependency seems to be needed by the

    
    
        org.springframework.android
        spring-android-rest-template
        ${spring-android-version}
    

Spring docs report that this 'hidden dependency' of which we're speaking is needed for RSS and Atom feed support by the rest-template.

What made this even weirder is that the initial activity annotated by AA got created and resolved nicely. As long as I didn't refer to a generated class, e.g. for navigation, then it did compile and run. From the moment I tried to use a class_ in code however, it went down this path.

Hope this helps !

本文地址:IT屋 ? Maven + AndroidAnnotations generated but not reachable classes

官方微信
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注与百万开发者在一起
错误添加自定义主题,以应用程序
我需要在我的BroadcastReceiver唤醒锁,如果我没有启动的服务或活动?