Jake
Jake

Reputation: 16877

Using compiled SDK in Android Studio

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

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) ?

Upvotes: 1

Views: 540

Answers (1)

Jake
Jake

Reputation: 16877

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

Upvotes: 1

Related Questions