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

ANDROID_HOME and ANDROID_SDK environment variables are not set #502

Closed
titobrasolin opened this issue Dec 13, 2017 · 4 comments
Closed

ANDROID_HOME and ANDROID_SDK environment variables are not set #502

titobrasolin opened this issue Dec 13, 2017 · 4 comments

Comments

@titobrasolin
Copy link
Contributor

ubuntu: 14.04.5 LTS
umake: 17.03

In my opinion the problem is here:
https://github.com/Ubuntu/ubuntu-make/blob/master/umake/frameworks/android.py#L133

add_env_to_user should be called only once (with a dictionary of environment variables) because it removes framework envs from user at every execution.

The debug messages look fine:

DEBUG: Adding
/home/theuser/.local/share/umake/android/android-sdk
to user's ANDROID_HOME for Android SDK
DEBUG: Adding $ANDROID_HOME to user's ANDROID_SDK for Android SDK
DEBUG: Adding $ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH to
user's PATH for Android SDK

Nevertheless, at the end only the PATH for Android SDK is written to .profile.

E.g. rust uses add_env_to_user correctly:
https://github.com/Ubuntu/ubuntu-make/blob/master/umake/frameworks/rust.py#L80

@titobrasolin
Copy link
Contributor Author

I modified android.py like this:

class AndroidSDK(umake.frameworks.baseinstaller.BaseInstaller):
[...]
    def post_install(self):
        """Add necessary environment variables"""
        # add a few fall-back variables that might be used by some tools
        # do not set ANDROID_SDK_HOME here as that is the path of the preference folder expected by the Android tools
        # add "platform-tools" to PATH to ensure "adb" can be run once the platform tools are installed via
        # the SDK manager
        add_env_to_user(self.name, {"ANDROID_HOME": {"value": self.install_path, "keep": False},
                                    "ANDROID_SDK": {"value": self.install_path, "keep": False},
                                    "PATH": {"value": [os.path.join(self.install_path, "tools"),
                                                       os.path.join(self.install_path, "platform-tools")]}})
[...]

It now works as expected (variables cannot be defined in terms of each other because dictionaries are not sorted).

By the way, it seems that Android NDK has similar problems.

@LyzardKing
Copy link
Collaborator

LyzardKing commented Dec 13, 2017 via email

@titobrasolin
Copy link
Contributor Author

Ok @LyzardKing Just give me a day or two (I'm quite busy on different tasks right now).

@titobrasolin
Copy link
Contributor Author

Hi @LyzardKing Here it is: #503
I ran pep8 and small tests.

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