Announcement

Collapse
No announcement yet.

ClassFactory and build process

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassFactory and build process

    We would like to better understand ClassFactory, import statements, and the build process in Android Studio. In ConceptTensorFlowObjectDetection we have the initVuforia method containing
    vuforia = ClassFactory.getInstance().createVuforia(parameter s) In the "libs" folder of our Android Studio project, we find the abstract class ClassFactory and getInstance() which seems to return an empty ClassFactory instance. The createVuforia(parameters) method is abstract and has an implementation in ClassFactoryImpl which lives in org.firstinspires.ftc.robotcore.internal.system.

    Starting from ConceptTensorFlowObjectDetection, how does the build process know where to find the implementation of createVuforia()? Are all "internal" folders automatically imported for any class? We are trying to trace back to some call to ClassFactoryImpl and we can't find any import statement or actual call to this class.

    Thanks.
    Team 9147

  • #2
    Code:
    ClassFactoryImpl.onApplicationStart();
    is called in RobotApplication.java, which initializes an instance of the ClassFactory.

    Comment


    • #3
      Thank you, I see it. And what calls RobotApplication? If I do ctrl-alt-F7 in Android Studio on this class, I get a message that there are "no usages". Thank you for your help.

      Comment


      • #4
        RobotApplication is called by the Android system when the application first launches. (If this were a desktop application, it would be the first thing called in
        Code:
        public static void main(String[] args)
        )

        As for what tells the Android system about it - it's declared as the main application class in AndroidManifest.xml of the RobotCore.aar library.

        Comment


        • #5
          We were able to find that too. We are enjoying poking around in the details and trying to understand what we can. Thank you so much for your help!

          Comment


          • #6
            Originally posted by FTC9147 View Post
            We were able to find that too. We are enjoying poking around in the details and trying to understand what we can. Thank you so much for your help!
            You should take a look at OpenRC then - all the libraries are extracted and source code reformatted to use an actually sane indentation style. It hasn't been upgraded to v 4.x yet, but the vast majority of the code will be the same.

            Comment

            Working...
            X