Hi everyone,
I downloaded the sources of an existing Android app and am trying to compile it on my NixOS system (19.09 stable) with the scripts shipping in the repository.
For this, I created the following default.nix
file that I use with nix-shell
:
with import <nixpkgs> {};
{
appEnv = stdenv.mkDerivation {
name = "app";
buildInputs = [openjdk androidenv.androidPkgs_9_0.androidsdk];
ANDROID_HOME = "/home/my-user/.android";
};
}
In order to be able to invoke nix-shell default.nix
, I needed to add the following lines to ~/.config/nixpkgs/config.nix
:
{
allowUnfree = true;
android_sdk.accept_license = true;
}
Afterwards, creating the nix-shell
worked, but when I run the application’s build script, I get the following error:
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Checking the license for package Android SDK Build-Tools 25.0.1 in /nix/store/69zj7qfqqnh2w8xzkasf6263rh4r2hz9-androidsdk/libexec/licenses
Warning: License for package Android SDK Build-Tools 25.0.1 not accepted.
Checking the license for package Android SDK Platform 25 in /nix/store/69zj7qfqqnh2w8xzkasf6263rh4r2hz9-androidsdk/libexec/licenses
Warning: License for package Android SDK Platform 25 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 25.0.1, Android SDK Platform 25].
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
After some searching, I found that this issue could be resolved by running sdkmanager --update
, which prints the license and ask Accept? (y/N):
.
After entering y
the following output appears
Warning: Failed to read or create install properties file.
done
and the build command produces the same error message as above.
I also tried adding the package and the accept_license
to /etc/nixos/configuration.nix
but it did not help as well.
Since I hit a roadblock there, I was wondering, if someone in the forum might have an idea on what may be wrong with my configuration, or what I could do to get the license accepted.