Android: Difference between revisions

imported>Jmarmstrong1207
No edit summary
imported>Jmarmstrong1207
m Add example
Line 1: Line 1:
== Using the Android SDK==
== Using the Android SDK ==
NixOS uses the androidenv package for building android SDKs and manually creating emulators without the use of Android Studio. Example android sdk is <code>androidenv.androidPkgs_9_0.androidsdk</code>. They also include all of the SDK tools such as sdkmanager and avdmanager needed to create emulators.
NixOS uses the androidenv package for building android SDKs and manually creating emulators without the use of Android Studio. Example android sdk is <code>androidenv.androidPkgs_9_0.androidsdk</code>. They also include all of the SDK tools such as sdkmanager and avdmanager needed to create emulators.


Line 9: Line 9:


When creating emulators with Nix's emulateApp function as mentioned in the first link, your IDE should now be able to recognize the emulator and run your code within it.
When creating emulators with Nix's emulateApp function as mentioned in the first link, your IDE should now be able to recognize the emulator and run your code within it.
Here is an example emulator:
<syntaxhighlight lang=nix>
with import <nixpkgs> {};
androidenv.emulateApp {
  name = "emulate-MyAndroidApp";
  platformVersion = "28";
  abiVersion = "x86"; # armeabi-v7a, mips, x86_64
  systemImageType = "google_apis_playstore";
}
</syntaxhighlight>
build it with <code>nix-build fileName.nix</code>. It'll build in the folder <code>result</code>. run it with <code>./result/bin/run-test-emulator</code>


== Creating emulators without Nix ==
== Creating emulators without Nix ==