title: Android SDK/NDK installation on Android
body: <p>I emulate Ubuntu on Android device using the <a href="https://play.google.com/store/apps/details?id=tech.ula&amp;pcampaignid=APPU_1_tNmTXO3TBZDB5OUPsvWpsAI" rel="nofollow noreferrer">UserLAnd app</a>. I wanna install <a href="https://github.com/tomaka/android-rs-glue/blob/master/README.md" rel="nofollow noreferrer">android-rs-glue</a> to package my Rust apps as APKs, but I need Android SDK/NDK properly installed. Here's the issue:</p>
  
  <blockquote>
    <p>Install some components in the SDK:</p>
  
  <pre><code>$ ./android-sdk/tools/bin/sdkmanager "platform-tools" "platforms;android-18" "build-tools;26.0.1"
  </code></pre>
  </blockquote>
  
  <p>Result:</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ sudo . "$ANDROID_HOME/bin/sdkmanager" \
          "platform-tools" \
          "platforms;android-18" \
          "build-tools;26.0.1"
  
  # Error: Could not find or load main class 
  #   com.android.sdklib.tool.sdkmanager.SdkManagerCli
  </code></pre>
  
  <p>I did:</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ export CLASSPATH=$CLASSPATH:$ANDROID_HOME/lib
  </code></pre>
  
  <p>After looking at <code>sdk/bin/sdkmanager</code> I deducted it also requires copy of <code>sdk/lib</code> as <code>~/lib</code>; then I get that:</p>
  
  <pre><code>Loading package information...                                                  
  Loading local repository...                                                     
  n% Loading local repository...        
  n% Fetch remote repository...
  6% Computing updates...               
  8% Computing updates...               
  8% Computing updates...               
  10% Computing updates...              
  10% Computing updates...
  
  Warning: File /root/.android/repositories.cfg could not be loaded.
  Warning: Failed to find package platforms
  </code></pre>
  
  <p>Gonna test it further.</p>