1

I am trying to compile android-6.0.1 from source and use the compiled SDK in Android Studio. To compile the SDK, I tried the commands:

 $ lunch sdk-eng
 $ make sdk

Also tried:

 $ lunch sdk-eng
 $ make PRODUCT-sdk-sdk showcommands

Compilation results 0 errors.

To add the SDK in Android Studio, I checked SO questions on how to change SDK path. I am facing issues after path change. The folder of my compiled SDK has key folders named android-6.0.1 such as

 platforms/android-6.0.1
 build-tools/android-6.0.1

Complete set of folders inside SDK is:

 add-ons  build-tools  docs  documentation.html  extras  platforms  platform-tools  RELEASE_NOTES.html  samples  system-images  tests

The compiled SDK is for API version 23.

The following are steps I tried so far to add the compiled SDK in Android Studio (version 2.1.2)

1) change sdk path -> Gradle sync begins ->

enter image description here

(Remember the sdk folder does have a build tools folder)

My apps build.gradle contains

android {
 compileSdkVersion 23
 buildToolsVersion "23.0.0"

 defaultConfig {
    applicationId "com.example.sdktest"
    minSdkVersion 22
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

2) build.gradle does not allow strings like 6.0.1 for platform name, so I attempted to rename relevant folders

  • platforms/android-6.0.1 --> platforms/android-23
  • build-tools/android-6.0.1 --> build-tools/23.0.0
  • system-images/android-6.0.1 --> system-images/android-23

Modified build-tools/23.0.0/source.properties to contain Pkg.Revision=23.0.0

I compared the build-tools folder in meld (left is the new compiled SDK; the folder hierarchy is identical, although I haven't checked all the differences yet):

enter image description here

[Update]

I tried to follow the Android Studio prompts to install build tools version 23.0.0 and also com.android.support:appcompat-v7:23.1.1 -> gradle sync starts again, and prints the following in the log (and then remains stuck):

  build-tools/23.0.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

I tried installing the package lib32z1 but it didn't resolve the problem. Has anyone tried fixing it on Debian jessie (64 bit) ?

Onik
  • 19,396
  • 14
  • 68
  • 91
Jake
  • 16,329
  • 50
  • 126
  • 202
  • 1
    _"so I attempted to rename relevant folders"_ No need to do that. General steps are: 1) change SDK path in AS by going to `Project Structure -> SDK Location` and pointing to the compiled SDK `out/host/linux-x86/sdk/android-sdk_eng.xxx_linux-x86`; 2) follow the IDE prompt and install the Build Tools as you mentioned in step 1. – Onik Nov 26 '16 at 20:15
  • You seem to be in the right condition to check [the solution](https://stackoverflow.com/questions/24857285/android-aosp-adding-app-to-packages-apps/40494023#40494023) to quite an old question of yours. Remember, by accepting a useful answer you indicate to the future issue seekers that the answer was correct, so helping them to resolve the issue faster. – Onik Nov 30 '16 at 21:58

1 Answers1

1

I installed the following libraries to solve it:

  • libc6-i386
  • lib32stdc++6
  • lib32gcc1
  • lib32ncurses5

I found the solution at this answer: https://stackoverflow.com/a/22592888

Community
  • 1
  • 1
Jake
  • 16,329
  • 50
  • 126
  • 202