Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Compatible with Instant app? #2017

Description

@evalo

hi, i'm refering to instant app codelab from google i/o, i moved the files from application module to base feature module (no feature module for now), but several times as i tried, the file is not generated. I'd like to know is there anyway i can make it work?
Thx

Activity

  1. dodgex commented on Jun 18, 2017

    @dodgex
    Member

    I have not tested it yet, but I'm pretty sure it should be compatible. You have to add the AndroidAnnotations processor and dependencies to each module that should use generated files.

  2. WonderCsabo commented on Jun 27, 2017

    @WonderCsabo
    Member

    @ealden i quickly read through the doc, and instant app module is pretty much the same as a library module. AA should work out of the box. Can you share an example project?

  3. WonderCsabo commented on Jul 20, 2017

    @WonderCsabo
    Member
  4. jaswanthm commented on Sep 1, 2017

    @jaswanthm

    The instant app config requires the app to be separated into 3 modules

    1. The feature module (with the base code) - com.android.feature
    2. The application module - com.android.application
    3. The instant app module - com.android.instantapp

    Now, since we moved the code from application -> feature module, Android Annotations is not working at all.

    I am having the same issue. If someone could help, it would be great.

    So the question again : Is there an android annotations version which supports instant app ?

  5. WonderCsabo commented on Oct 30, 2017

    @WonderCsabo
    Member

    @jaswanthm AndroidAnnotations fully support library projects. Please try to configure these as library projects.

  6. mrhabibi commented on Apr 3, 2018

    @mrhabibi

    Hi, I've followed google's instructions with example project to learn migrating ordinary project to instant-apps project, here's the link: https://codelabs.developers.google.com/codelabs/android-instant-apps

    And it works fine.

    But when I add AA dependency and kotlin in build.gradle:

    apply plugin: 'com.android.feature'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt'
    ...
    kapt "org.androidannotations:androidannotations:4.4.0"
    implementation "org.androidannotations:androidannotations-api:4.4.0"
    

    And adding a simple annotation @EView in one of its classes, it won't compile, it says:

    e: error: Could not find the AndroidManifest.xml file, using  generation folder [/Users/mrhabibi/Projects/android-topeka/topeka-base/build/generated/source/kapt/debugFeature])
    :topeka-base:kaptDebugFeatureKotlin FAILED
    

    I've been struggling for days and got stuck, actually I have other project that uses AA too and get the same problem, can anyone help me with this? Thanks.

  7. ManuelSchmitzberger commented on Oct 24, 2018

    @ManuelSchmitzberger

    I'm currently working on Android instant apps by using the android-topeka example project.

    Everything works as expected, after I'm using AndroidAnnotations on my Activity:

    @EActivity(resName = "activity_start")
    public class StartActivity extends AppCompatActivity {
    ...
    }
    

    If I want to start the application(:installed) one, everything works, but for the instant-app(:instant), I get the following error:

        :base:javaPreCompileDebugFeature UP-TO-DATE
        error: The generated <applicationId>.R class cannot be found
        1 error
        :base:compileDebugFeatureJavaWithJavac FAILED
    

    Additional Info:

    If I remove the application project(':installed') in the base
    build.gradle I can start the instant-app but with the wrong
    application-id (configured in the :installed project).

  8. dodgex commented on Oct 24, 2018

    @dodgex
    Member

    @ManuelSchmitzberger this only happens when AndroidAnnotations is added to the project? Looks strange to me, as from what you have posted as errors I'm not sure how AA could be involved in the issue. 🤔

  9. dodgex commented on Oct 24, 2018

    @dodgex
    Member

    Can you provide an up to date demo project (ready for AS 3.2.1 and latest tooles)? then I can try to check what is worng or needs to be done.

  10. ManuelSchmitzberger commented on Oct 24, 2018

    @ManuelSchmitzberger

    @dodgex Thx for your response!

    @ManuelSchmitzberger this only happens when AndroidAnnotations is added to the project? Looks strange to me, as from what you have posted as errors I'm not sure how AA could be involved in the issue.

    yes.

    Can you provide an up to date demo project (ready for AS 3.2.1 and latest tooles)? then I can try to check what is worng or needs to be done.

    Here you can download the project setup.

    How you can reproduce:

    • run the :instant configuration -> everything fine
    • add the @EActivity(resName = "activity_start") annotation to the StartActivity class (base-project)
    • change android:name="com.test.StartActivity" to android:name="com.test.StartActivity_" in the Manifest (also in the base-project)
    • run the :instant configuration again
    • now you can see the error:
      error: The generated com.test2.R class cannot be found
  11. dodgex commented on Oct 25, 2018

    @dodgex
    Member

    @ManuelSchmitzberger not sure how you got to the r class error...

    I updated the project to AS 3.2.1 - as requested - and with latest AA i get AndroidManifest cant be found, as mrhabibi posted in april.

    i'll see if i find a way to fix the manifest finder issue and see if the build works then.

  12. dodgex commented on Oct 25, 2018

    @dodgex
    Member

    I think i got a working build with instant app. not yet tested if the result runs, and if it works with split/flavours. so i have to do some more testing and cleanup but i'm confident to get it fully working. :)

  13. dodgex commented on Oct 26, 2018

    @dodgex
    Member

    @ManuelSchmitzberger can you test for your version of the project configuration if it works with the following config in your base\build.gradle

    I migrated my project to gradle build plugin 3.2.1 and after fixing the Manifest Finder issues i got the error: The generated com.test2.R class cannot be found error but the given option fixed it for me. :)

    android {
        // ...
        defaultConfig {
            // ...
            javaCompileOptions {
                annotationProcessorOptions {
                    arguments = ["resourcePackageName": "com.test"]
                }
            }
        }
    }
    
  14. ManuelSchmitzberger commented on Oct 29, 2018

    @ManuelSchmitzberger

    @dodgex Thank you very much! It's so strange, I've tested that several times and now it seems to work.
    you saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions