Closed Bug 1576471 Opened 5 years ago Closed 5 years ago

ANDROID_SDK_ROOT environment variable overrides --with-android-sdk and prevents tests from running

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox70 fixed)

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: robwu, Assigned: robwu)

Details

Attachments

(1 file)

My system is as follows:

  • .mozconfig contains ac_add_options --with-android-sdk="/path/to/.mozbuild/android-sdk-macosx" (from an earlier ./mach bootstrap run, where it was recommended)
  • There is a system-wide Android SDK installation, in ANDROID_SDK_ROOT=/usr/local/share/android-sdk
  • I accepted licenses for the one on ~/.mozbuild, but not in the system-wide install.

When I try to run tests, the execution fails because somehow the incorrect android-sdk is being used, as the log below shows.

When I run ./mach environment --verbose, then I see that ANDROID_SDK_ROOT is set to the one from mozconfig, so settings.gradle sets android.home, and I would expect the command to run just fine.

If I unset ANDROID_SDK_ROOT and then run the command again, everything works as expected.

$ ./mach test mobile/android/components/extensions/test/
 0:00.92 adb INFO Using adb 1.0.41
 0:01.40 adb INFO adbd running as root
 0:01.51 adb INFO su -c setenforce 0 exitcode 0, stdout: None
 0:01.86 adb INFO su 0 supported
 0:02.09 adb INFO /system/bin/ls -1A supported
 0:02.20 adb INFO Native cp support: True
 0:02.32 adb INFO Native chmod -R support: True
 0:02.44 adb INFO Native chown -R support: True
 0:02.55 adb INFO Setting SELinux Permissive
 0:02.78 adb INFO Native pidof support: True
Re-install geckoview AndroidTest? (Y/n)
Installing geckoview AndroidTest...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf-8

> Configure project :app
Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/local/share/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /usr/local/share/android-sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: /usr/local/share/android-sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

I added "--stacktrace", "debug" to the gradle command at https://searchfox.org/mozilla-central/rev/0a6d4a24f83da7d2d2acbac919358c8499ddad2f/testing/mozbase/mozrunner/mozrunner/devices/android_device.py#250

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: General → Android Studio and Gradle Integration
Component: Android Studio and Gradle Integration → General
Attachment #9087993 - Attachment description: Bug 1576471 - Ignore ANDROID_SDK_ROOT env var if --with-android-sdk is set → Bug 1576471 - Set ANDROID_SDK_ROOT env var if --with-android-sdk is set
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/85ac77f6cbcb
Set ANDROID_SDK_ROOT env var if --with-android-sdk is set r=nalexander
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Assignee: nobody → rob
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: