Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Clarification of run statement in documentation for cross building to Android #3633

Open
zflat opened this issue Mar 15, 2024 · 2 comments
Assignees

Comments

@zflat
Copy link

zflat commented Mar 15, 2024

At the very end of the https://github.com/conan-io/docs/blob/develop2/examples/cross_build/android/ndk.rst example there is the statement:

Unless you have access to a root Android device, running the test application or using the built library is not possible directly so it is more common to build an Android application that uses the hello library.

This is a pretty long sentence and I don't understand what is trying to be stated. Is it saying that this example is for a library only (Library module)? Can a similar approach be used to build an app (App module)? Or can an android app only be built from android studio as described at https://github.com/conan-io/docs/blob/develop2/examples/cross_build/android/android_studio.rst?

@memsharded memsharded self-assigned this Mar 15, 2024
@memsharded
Copy link
Member

Hi @zflat

Thanks for your question.
I agree that that sentence is not very clear. It refers to the test_package/conanfile.py code:

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def layout(self):
        cmake_layout(self)

    def test(self):
        if can_run(self):
            cmd = os.path.join(self.cpp.build.bindir, "example")
            self.run(cmd, env="conanrun")

And that the can_run() will return by default False and that the example application will not be launched, because it will fail to run in a normal windows/linux/osx machine.

This is not really related to how libraries are used by real android apps, it is just about the typical creation of an executable in test_package. For Android, the test_package will at least guarantee that the headers can be found, the library can be found and be linked, etc.

Please let me know if this clarifies the issue a bit.

@zflat
Copy link
Author

zflat commented Mar 19, 2024

If I understand your clarification, I would like to suggest some edits to make this more clear:

- Unless you have access to a root Android device, running the test application or using the built library is not possible directly so it is more common to build an Android application that uses the hello library.
+ The non-native test application is not possible to run on the same architecture as your local computer. Directly running the test application or using the built library is possible if you use a root Android device. It is more common to build an Android application that uses the hello library and test using typical Android development workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants