Created
July 26, 2019 14:40
-
-
Save Jomik/17efba3a26bd3a1e8475006ba25155ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> { config.android_sdk.accept_license = true; }; | |
let | |
inherit (pkgs) mkShell openjdk; | |
androidPkgs = androidenv.composeAndroidPackages { | |
platformVersions = [ "28" ]; | |
abiVersions = [ "x86" "x86_64"]; | |
includeEmulator = true; | |
}; | |
inherit (androidPkgs) androidsdk; | |
in mkShell { | |
JAVA_HOME = "${openjdk}"; | |
ANDROID_HOME = "${androidsdk}"; | |
buildInputs = with pkgs; [ | |
nodejs-10_x | |
androidsdk | |
]; | |
} |
Try it like this, fixed these errors for me:
let
androidsdk = pkgs.androidsdk_9_0.overrideAttrs (oldAttrs: {
useGoogleAPIs = true;
includeSystemImages = true;
includeEmulator = true;
});
in pkgs.mkShell {
ANDROID_HOME = "${androidsdk}/libexec/android-sdk";
# …
}
(nixpkgs 20.09pre218613.ae6bdcc5358
)
Upon tns run android
I always hit this though:
[nix-shell:/…]$ yarn run tns run android
yarn run v1.22.4
$ …/node_modules/.bin/tns run android
Searching for devices...
Preparing project...
File change detected. Starting incremental webpack compilation...
Starting type checking service...
Using 1 worker with 4096MB memory limit
…
Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (android)
Building project...
Gradle build...
+ setting applicationId
+ applying user-defined configuration from /…/app/App_Resources/Android/app.gradle
+ using android X library androidx.legacy:legacy-support-v4:1.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: /…/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar
Execution failed for task ':app:mergeDebugResources'.
error=2, No such file or directory
Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.
^C
[nix-shell:…]$
Not sure which file it is missing… I'm trying to build the Svelte Native template.
If you have new findings please let me know.
I figured it out! The easiest way to work around this problem is using buildFHSUserEnv, as documented here https://nixos.wiki/wiki/Android#gradlew
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output of
tns doctor