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-studio: repackage in an FHS environment #16752

Merged
merged 1 commit into from
Aug 11, 2016

Conversation

phunehehe
Copy link
Contributor

@phunehehe phunehehe commented Jul 6, 2016

Motivation for this change

Android (studio) can and wants to manage its own packages. The current packaging approach doesn't allow such management. As a result the package is unusable (see #8650 and #14903).

@jagajaga has a nix-shell configuration, which I have adapted into a package. The quality is pretty much "work for me", but hey, it works :)

Oracle JDK is a nuisance to install (unfree and requires a manual download), but I got an exception with Open JDK and I have little clue how to continue that way.

Would this be nearly good enough to replace the current package?

Things done
  • Tested using sandboxing
    (nix.useChroot on NixOS,
    or option build-use-chroot in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@bjornfor
Copy link
Contributor

bjornfor commented Jul 6, 2016

Can you please put the PR cover message into the commit (the "motivation for this change")?

@jagajaga
Copy link
Member

jagajaga commented Jul 6, 2016

Please also grep for existing android studio in pkgs. And do something with it. Cc @offlinehacker

@@ -0,0 +1,49 @@
{ pkgs ? import <nixpkgs> {} }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take each parameter you need "{ coreutils, findutils, ..." instead of "pkgs ? import {}".

@edwtjo
Copy link
Member

edwtjo commented Jul 6, 2016

Please also take the liberty of removing android-studio and buildAndroidStudio from ideas in your commit to avoid any future confusion. Perhaps that is what @jagajaga meant but better to be explicit.

@phunehehe phunehehe force-pushed the android-studio branch 2 times, most recently from 58d52e4 to b7a5dcd Compare July 7, 2016 12:28
@phunehehe
Copy link
Contributor Author

@bjornfor @jagajaga @edwtjo done, how about that?

@bjornfor
Copy link
Contributor

bjornfor commented Jul 7, 2016

@phunehehe: Good! You say it "works for me", does that mean everything [you've done] is working? Or is there (still) issues that makes Nix + android-studio a pain?

@phunehehe
Copy link
Contributor Author

@bjornfor admittedly I'm not a hardcore Android guy anymore, but everything I want to use works. That includes installing SDK components, importing an app and debugging it with a hardware device (via adb). I haven't tried using a virtual device though, not very useful IMO.

@jagajaga
Copy link
Member

jagajaga commented Jul 8, 2016

LGTM

@jagajaga
Copy link
Member

@bjornfor can you please test this PR? I can't do it these days.

@bjornfor
Copy link
Contributor

@jagajaga: Sure. Note that I have no prior experience with android-studio, so it'll be from a novice' perspective.

@bjornfor bjornfor self-assigned this Jul 12, 2016
@bjornfor
Copy link
Contributor

I thought I'd just mention a few people for feedback (and possibly test): @bobvanderlinden, @geraldus, @Radivarig

@bjornfor
Copy link
Contributor

Some testing notes.

After starting android-studio and running the setup wizard, a dialog window pops up:

Unable to run mksdcard SDK tool.
One common reason for this is missing 32 bit compatibility libraries.
Please fix the underlying issue and retry.

I can only click "retry" or "cancel". Pressing "retry" just shows the same message agin and "cancel" shows the installer log:

Downloading android-sdk_r22.6.2-linux.tgz from https://dl.google.com/android/android-sdk_r22.6.2-linux.tgz
Unpacking android-sdk_r22.6.2-linux.tgz
/usr/bin/tar xzvfC /tmp/AndroidStudio0FirstRun/android-sdk_r22.6.2-linux.tgz /tmp/AndroidStudio0FirstRun/android-sdk_r22.6.2-linux.tgz-unpacked
Unable to run mksdcard SDK tool.

Is it trying to run prebuilt binaries without correct interpreter (e.g. /lib/ld-linux.so)?

I can move forward by clicking "finish" at this point and see the Welcome screen where I can chose e.g. "Start a new Android Studio Project". However, selecting that results in:

Your Android SDK is missing, out of date, or is missing templates.
You can configure your SDK via Configure | Project Defaults | Project Structure | SDKs

Going there (Configure -> ...) I see two misconfigurations (highlighted in the status bar), the "Android SDK location" is empty (I set it to ~/Android/Sdk (because I noted that path during the setup wizard). Then there is the blocker: "Please choose a valid JDK directory". The JDK location is already filled: /nix/store/3y10awsnnf20hv66gbr06dm821czgi42-openjdk-8u102b04/lib/openjdk, but apparently the wizard doesn't like that path (or it actually is wrong).

Any ideas?

@bjornfor
Copy link
Contributor

Ah, the existing path was to openjdk, but Android Studio wants to oraclejdk . Using the nix-build -A oraclejdk8 path fixes the configuration and I'm able to start the "Create New Project" wizard.

@phunehehe
Copy link
Contributor Author

@bjornfor I wonder how openjdk got in there? There's a wrapProgram piece that sets the PATH to the jdk that is passed in, and that should be oraclejdk8 already.

@bjornfor
Copy link
Contributor

@phunehehe: I've started android-studio before, a couple of weeks ago. I obviously didn't get very far because that version fails do install the SDK due to the read-only Nix store. But I think that version was using openjdk... I think I remember a warning in android-studio exactly about that ("expect issues with openjdk, better use oracklejdk" or something like that). Maybe it simply remembered the previous JDK path?

@bjornfor
Copy link
Contributor

I created an empty project using the wizard. There were some warnings and finally some fatal build errors. Part of the problem was solved by downloading more stuff via Android Studio (it showed what to do). But still the build failed, from the Gradle build log:

:app:mergeDebugResources
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/AndroidStudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-ldrtl-hdpi-v17/abc_ic_ab_back_mtrl_am_alpha.png
Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/bfo/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 127
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> /home/bfo/AndroidStudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-ldrtl-hdpi-v17/abc_ic_ab_back_mtrl_am_alpha.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/bfo/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 127
Information:BUILD FAILED
Information:Total time: 1.606 secs
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
/home/bfo/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: wrong ELF class: ELFCLASS64
Information:2 errors

(I'm on x86_64-linux NixOS.)

@bjornfor
Copy link
Contributor

I wanted to have a look at the issue with our existing android studio. This time I tried starting with a clean state (I hope this is enough... at least it's enough to force the the setup wizard on the next run):

rm -rf ~/Android* ~/.AndroidStudio*

At startup the wizard complains that /nix/store/.../libexec/android-sdk-linux is not writeable. I point it to ~/android-sdk-linux instead and the setup continues. Like the fhs-version, this one also is "Unable to run mksdcard SDK tool", presumably due to missing 32-bit libs.

I continued on and created a new / empty project. This time however, there are no build errors and I see a preview of the application (I don't think it's the real emulator) in the middle of the IDE.

What were the issues with android-studio again??

@bjornfor
Copy link
Contributor

Refreshed my memory a bit and got feedback from @svanderburg (#8650 (comment)). At this point I'm thinking we shouldn't replace android-studio with the FHS variant (like this PR does), but if anything, add it on the side (android-studio-fhs?).

Thoughts?

@bjornfor bjornfor removed their assignment Jul 12, 2016
@geraldus
Copy link

@bjornfor sorry, I have no NixOS installed at this moment.

@phunehehe
Copy link
Contributor Author

I saw the "mksdcard" error before. It was gone after converting to FHS. I have now cleared my state files and it's coming back. Should be fixable, I'll track it down.

Same for "libz", I included zlib specifically for that. Can't reproduce it yet because of the "mksdcard" problem, but again should be fixable.

I gave up on the existing android-studio package after seeing a startup dialog without text (screenshot below) and the issues linked from the top comment.

screenshot from 2016-07-13 16 46 13

As for android-studio and/or android-studio-fhs, there are many ways to reason about it, but I think the most practical way is, what's the capacity of the community? From easiest to hardest:

  1. Package the binaries and their dependencies, let the application handle its own state files. This is what we see with e.g. Chromium. Nixpkgs doesn't try to handle Chromium plugins.
  2. Package the application with a declarative set of plugins. emacsWithPackages is an example. A considerable level of application support, as well as gluing from Nixpkgs, is needed. This is admittedly a bad example, as Emacs also support (1). I don't know if we have a package that supports (2) without supporting (1).
  3. Support both of the above e.g. emacs and emacsWithPackages. Of course this comes with some maintenance overhead.

It seems like we have some form of (2), which nobody uses (that's the impression I have after going through all the android-studio issues, though I'm happy to be corrected). Does it make sense to admit we don't have the bandwidth, and try to at least make (1) work?

@phunehehe
Copy link
Contributor Author

^ I realize that might come across as harsh. As you can see in the top comment, my original intention was to ask whether this new package should replace the existing package.

@bjornfor
Copy link
Contributor

@phunehehe: I didn't pick up any "harshness" :-)

That screenshot looks like it comes from Ubuntu. On NixOS it does have text:

image

Maybe that "missing text" thing is a generic issue on non-NixOS (i.e. not related to android-studio in particular)?

I hope we can have option (3): support both imperative and declarative setups.

I'm going to play a bit more with android-studio (with/without FHS).

@svanderburg
Copy link
Member

@bjornfor For me it's fine to have an android-studio in an FHS user/chroot environment. Of course, having a Nix-deployed version using the Nix-deployed Android SDK is nice for some purposes, but probably inconvenient in many other areas.

@bjornfor
Copy link
Contributor

I don't understand why the FHS userenv/chroot should make a difference as to where the SDK is located (in read-only nix store or not). The FHS chroot just appears to have a traditional filesystem layout, but that doesn't make every directory writeable.

I tried running existing android-studio with a modified expression, to remove $ANDROID_HOME (was: ANDROID_HOME="${androidsdk}/libexec/android-sdk-linux/"). Now I don't see any complaints about read only Nix store. Android studio simply suggests to use ~/Android/Sdk and downloads a bunch of stuff there. And then one time I have to specify that path manually during setup wizard.

(Of course, still fails to run mksdcard, but this PR doesn't change that.)

@edwtjo: Any thoughts on the ANDROID_HOME setting (a46065c)?

@phunehehe
Copy link
Contributor Author

@bjornfor I have been playing a bit and my memory is coming back. Certain Android build tools are shipped as 32 bit binaries https://code.google.com/p/android/issues/detail?id=82711. I don't think it's possible to support that with a normal package, which was why I started this PR in the first place. I think the actual fix (multiPkgs) got lost in the various "improvements" I made 😊

The "no text" problem went away with Oracle JDK 8, I guess it works on NixOS due to some supporting environment variables. But that doesn't matter anymore given the 32 bit binaries.

For cleaning up state to test, be sure to remove .android and .gradle too.

I have a working thing that I should be able to push shortly.

@edwtjo
Copy link
Member

edwtjo commented Jul 13, 2016

@bjornfor I refer to my comment a year ago #8650 (comment) that I'm in favour of removing ANDROID_HOME from the wrapper. So far no one using android-studio has done so but it seems like it is the most appropriate change to get studio into a workable state, well that and passing oraclejdk.

@phunehehe
Copy link
Contributor Author

So... what's blocking here? I think this is the third time I'm rebasing to fix conflicts.

@bjornfor
Copy link
Contributor

@phunehehe: Oh, I guess I missed you comment from ~2 weeks ago. I didn't know you had updated the PR. I'll test locally and merge.

@phunehehe
Copy link
Contributor Author

phunehehe commented Jul 31, 2016

@bjornfor: Thanks. One thing I'm not sure about is the package names android-studio-openjdk vs android-studio-oraclejdk. Maybe they should be android-studio (default to OpenJDK) and android-studio-oraclejdk? I also don't have a strong opinion about the path, so if you still feel idea.android-studio is right I'm happy to change to that too.

@bjornfor
Copy link
Contributor

@phunehehe: If it was me doing the change I would have kept the attribute name idea.android-studio (no breakage or churn, and it's still an IDEA based IDE) and defaulted to openjdk. I don't think it scales very well to add -oraclejdk packages, so I'd rather let users override the package to provide their desired java implementation, or add config.android-studio.jdk nixpkgs option.

But I'm OK with merging as is. I often become overly focused on details, trying not to let it take over :-)

@bjornfor
Copy link
Contributor

I tried to use the patch for the emulator, but run into some driver issues. As such I'm not comfortable putting it in under my name.

The driver issues you mention (https://gist.github.com/phunehehe/3390ef17fae770f6028c7776a39fb641) might be due to #9415 ("libGL not working on non-NixOS (without setting up)").

I'll probably add that emulator patch at some point myself, no worries.

@bjornfor
Copy link
Contributor

@phunehehe: Let me know if you want me to merge.

@phunehehe phunehehe force-pushed the android-studio branch 2 times, most recently from 7aae4f4 to ac6c051 Compare August 1, 2016 04:41
@phunehehe
Copy link
Contributor Author

@bjornfor: Agree on the overriding, somehow it never occurred to me. The latest update addressed that.

As for idea.android-studio, I gave it another try with the patch below, but ran into 2 problems:

  • nix-env -f . -i android-studio can't find the package, resulting in error: selector ‘android-studio’ matches no derivations. This is not new, master has the same problem.
  • The override as described in the comment doesn't work anymore.

Ideas? (No pun intended.)

diff --git a/pkgs/applications/editors/idea/default.nix b/pkgs/applications/editors/idea/default.nix
index c113b63..27d8bea 100644
--- a/pkgs/applications/editors/idea/default.nix
+++ b/pkgs/applications/editors/idea/default.nix
@@ -121,6 +121,19 @@ in

 {

+  # Oracle JDK is recommended upstream, but unfree and requires a manual
+  # download. OpenJDK is straightforward, but may suffer from compatibility
+  # problems e.g. https://code.google.com/p/android/issues/detail?id=174496.
+  # To use Oracle JDK add an override to ~/.nixpkgs/config.nix:
+  # {
+  #   packageOverrides = pkgs: {
+  #     idea.android-studio = pkgs.idea.android-studio.override {
+  #       jdk = pkgs.oraclejdk8;
+  #     };
+  #   };
+  # }
+  android-studio = callPackage ../android-studio { };
+
   clion = buildClion rec {
     name = "clion-${version}";
     version = "1.2.5";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3142a28..ffe0353 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12252,19 +12252,6 @@ in

   amsn = callPackage ../applications/networking/instant-messengers/amsn { };

-  # Oracle JDK is recommended upstream, but unfree and requires a manual
-  # download. OpenJDK is straightforward, but may suffer from compatibility
-  # problems e.g. https://code.google.com/p/android/issues/detail?id=174496.
-  # To use Oracle JDK add an override to ~/.nixpkgs/config.nix:
-  # {
-  #   packageOverrides = pkgs: {
-  #     android-studio = pkgs.android-studio.override {
-  #       jdk = pkgs.oraclejdk8;
-  #     };
-  #   };
-  # }
-  android-studio = callPackage ../applications/editors/android-studio { };
-
   antimony = qt5.callPackage ../applications/graphics/antimony {};

   antiword = callPackage ../applications/office/antiword {};

@bjornfor
Copy link
Contributor

bjornfor commented Aug 1, 2016

@phunehehe:

nix-env -f . -i android-studio can't find the package, resulting in error: selector ‘android-studio’ matches no derivations. This is not new, master has the same problem.

It works here (master, 5fbe282):

$ nix-env -f . -i android-studio
installing ‘android-studio-2.1.2.0’
these derivations will be built:
  /nix/store/ry8cpv62slny6fvq9s2qz1x8v4r9a61l-sysimg-armeabi-v7a-23.drv
  /nix/store/46pq0nn9fgkjigxz1l3d86cp7wwmq6p1-android-sdk-25.1.7.drv
  /nix/store/1zcdmdg30y9xkca9jzyp4rv50iawq5bg-android-studio-2.1.2.0.drv

The override as described in the comment doesn't work anymore.

That override is for idea.android-studio but the current PR uses android-studio. When overriding the correct attrpath, it works fine here.

@bjornfor
Copy link
Contributor

bjornfor commented Aug 1, 2016

Oh, now I see there were two comments with override examples. Anyway, does it work for you now?

@phunehehe
Copy link
Contributor Author

@bjornfor The "matches no derivations" error only appears after putting in the override. It seems you can't override idea.android-studio "in one go". This works:

idea = pkgs.idea // {
  android-studio = pkgs.idea.android-studio.override {
    jdk = pkgs.oraclejdk8;
  };
};

Or at least, that lets me install the package by name. However, the override doesn't have any effect, as the package still uses openjdk:

$ cat /home/phunehehe/.nix-profile/bin/android-studio
#!/nix/store/b4xk5zs6w92xnzg851idlh2380401id1-bash-4.3-p42/bin/bash
/nix/store/5dbwf8n7scacdf1c0ky9a7ab32wr629f-android-studio-fhs-env/bin/android-studio-fhs-env /nix/store/5j2dsiip7ilm9qmz916dykgrxpklf9yq-android-studio/bin/studio.sh
$ cat /nix/store/5j2dsiip7ilm9qmz916dykgrxpklf9yq-android-studio/bin/studio.sh 
#! /nix/store/b4xk5zs6w92xnzg851idlh2380401id1-bash-4.3-p42/bin/bash -e
export PATH="/nix/store/038z6c3idjsy5a4gkqb70s1vml7ydylw-coreutils-8.25/bin:/nix/store/izh9gsfvi765hi89b0mwnfd58l4xgxd7-findutils-4.6.0/bin:/nix/store/8nm7vp5zw2lq3y2bvmq4yjnn2qgcm9rq-gnugrep-2.25/bin:/nix/store/65hj6acl9a4zm1ql5adnmv7hnhh8gdjv-openjdk-8u102b04/bin:/nix/store/jjcmjxni6fnfygczgb6nw0w3jfsfjr4g-which-2.21/bin:/nix/store/pgfnwxr4ky923p82qyjf8mf8mr7m3hvs-gnutar-1.29/bin:/nix/store/5nqba8ajfa3q91nvkyz7ddvvdyv8n7vq-gzip-1.8/bin:/nix/store/1r19dywf6nhyhjkgzd9i5kfqz8xn841a-git-2.9.1/bin"
export LD_LIBRARY_PATH="/nix/store/254i6ng5nq7gkjqrc5jjdx9pvzcgqvws-gcc-5.4.0-lib/lib:/nix/store/c605hb43sxsg1jydvkbgz8z305wzbfkl-gcc-5.4.0-lib/lib:/nix/store/h9bp147x3xll1fvsnnh0rcc68bcqg67k-zlib-1.2.8/lib:/nix/store/n9yf8mvb8qvbgwzr3zz1yjahfagdbfgi-libXrandr-1.5.0/lib"
exec -a "$0" /nix/store/5j2dsiip7ilm9qmz916dykgrxpklf9yq-android-studio/bin/.studio.sh-wrapped "${extraFlagsArray[@]}" "$@"

@bjornfor
Copy link
Contributor

bjornfor commented Aug 1, 2016

I'm not sure how to debug this, but I imagine it's related to the recurseIntoAttrs and how the 'jdk' attribute is inherited from an outer scope, rather than being a direct function argument to the inner mkDerivation. As the expression is written on current master, I think the override must be applied on the ideas attrset itself, and it will override all of the ideas packages.

@phunehehe
Copy link
Contributor Author

phunehehe commented Aug 1, 2016

@bjornfor Then let's merge this as is? Unless someone else shows up of course.

@bjornfor
Copy link
Contributor

bjornfor commented Aug 1, 2016

@phunehehe: Hm, if you agree with my suggestions, of course I'd like to see them implemented before merge :-) But I'm rather busy now (for up to 3 weeks), so ... :-/

@phunehehe
Copy link
Contributor Author

@bjornfor would it help if I "revoke" my agreement :)

@tadfisher
Copy link
Contributor

As a full-time Android engineer, I'm seeing two use cases which suggest two approaches to the problem.

  1. CI environments, for which NixOS is ideally suited in general. Reproducible builds are easiest to manage through an environment tailored for this use case. The Android command-line tools do not make this easy or possible, so it falls on distribution packaging to provide consistent dependencies and build environments. The existing androidenv packaging provides for this case. Incidentally, I have written a python script which wraps the SDK tools to provide similar functionality for any environment; however it is not exactly "reproducible" because the Android SDK tools do not allow fetching specific package revisions, only the latest.

  2. Development environments, specifically for developers using Android Studio, for which NixOS packaging gets in the way. Waiting for support library updates and such to be packaged would be a severe hassle for me, so I'd prefer removing the dependency on androidenv from the idea.android-studio derivation and letting Studio manage the SDK in my home directory.

I'm not convinced a full FHS hierarchy is necessary to achieve (2). What I would suggest is for Nix to package just the 32-bit binaries which cause problems and to have users fudge the path themselves or manually create emulator images using the Nix-patched binaries. The problems I care about daily are not running emulators but simply keeping the Java libraries and Maven repos up to date, and there are plenty of alternative solutions to running the official emulator.

@stefaj
Copy link

stefaj commented Aug 8, 2016

Sorry for butting in here, but why isn't this getting merged?

I'm also currently using jagajaga configuration as the current package is unusable.

@globin globin added the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 8, 2016
@globin
Copy link
Member

globin commented Aug 8, 2016

Please rebase

This commit fixes 2 main problems:

  - Android Studio comes with its own package manager. The current
    packaging approach doesn't allow such management. As a result the
    package is unusable (see
    NixOS#8650 and
    NixOS#14903). In this version,
    $ANDROID_HOME is _not_ set, allowing Android Studio to deal with the
    Android SDK as it pleases (typically in $HOME/Android/Sdk).

  - Android Studio downloads prebuilt binaries as part of the SDK. These
    tools (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the
    interpreter. An FHS environment is used as a work around for that.
@phunehehe
Copy link
Contributor Author

@globin: done

@globin globin merged commit cfdab94 into NixOS:master Aug 11, 2016
@phunehehe phunehehe deleted the android-studio branch August 12, 2016 05:27
@spacekitteh
Copy link
Contributor

spacekitteh commented Feb 6, 2017

So, I think I've run into a bug related to this, and I'm not sure if it's a NixOS problem or not.

I'm trying to build microG as part of AOSP in a FHS env, and I keep getting a license error from the Android Gradle plugin:

You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 24, Android SDK Build-Tools 24.0.3].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

I have followed the instructions in that link, but it seems like nothing I try results in the Gradle plugin picking up the license acceptances.

For reference, I've installed:

  • androidenv.platformTools
  • androidenv.androidsdk_7_0
  • androidenv.platforms.platform_24
  • androidenv.buildTools modified to use 24.0.3

So yeah. Any ideas what's the cause of this?

@phunehehe
Copy link
Contributor Author

@spacekitteh not related at all :)
You are probably using the Nix-managed Android SDK. This change lets Android Studio manage the SDK components.
Maybe follow the links in the top comment.

# {
# packageOverrides = pkgs: {
# android-studio = pkgs.android-studio.override {
# jdk = pkgs.oraclejdk8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove this warning. Openjdk seems to be the gold standard now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.