Using compiled SDK in Android Studio

二次信任 提交于 2020-02-05 02:36:07

问题


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

(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):

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


回答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



来源:https://stackoverflow.com/questions/40822299/using-compiled-sdk-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!