在Android Studio中使用已编译的SDK [英] Using compiled SDK in Android Studio

查看:416
本文介绍了在Android Studio中使用已编译的SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从源代码编译android-6.0.1,并在Android Studio中使用已编译的SDK.要编译SDK,我尝试了以下命令:

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

也尝试过:

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

编译结果为0错误.

要在Android Studio中添加SDK,我检查了有关如何更改SDK路径的问题.路径更改后,我面临问题.我编译的SDK的文件夹中有名为android-6.0.1的关键文件夹,例如

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

SDK中完整的文件夹集是:

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

编译后的SDK适用于API版本23.

The compiled SDK is for API version 23.

以下是我到目前为止尝试在Android Studio(版本2.1.2)中添加已编译的SDK的步骤

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

1)更改sdk路径-> Gradle同步开始->

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

(请记住,sdk文件夹中确实有一个构建工具文件夹)

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

我的应用程序build.gradle包含

android {
 compileSdkVersion 23
 buildToolsVersion "23.0.0"

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

2)build.gradle不允许使用6.0.1之类的字符串作为平台名称,因此我尝试重命名相关文件夹

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-> platform/android-23
  • build-tools/android-6.0.1-> build-tools/23.0.0
  • system-images/android-6.0.1-> system-images/android-23

修改了build-tools/23.0.0/source.properties以包含Pkg.Revision=23.0.0

我在Meld中比较了build-tools文件夹(左侧是新编译的SDK;文件夹层次结构是相同的,尽管我尚未检查所有差异):

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

[更新]

我试图按照Android Studio的提示安装版本23.0.0的构建工具,并且com.android.support:appcompat-v7:23.1.1-> gradle同步再次开始,并在日志中打印以下内容(然后保持原状):

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

我尝试安装软件包lib32z1,但无法解决问题.有没有人尝试在Debian jessie(64位)上修复它?

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

推荐答案

我安装了以下库来解决该问题:

I installed the following libraries to solve it:

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

我在以下答案中找到了解决方案: https://stackoverflow.com/a/22592888

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

这篇关于在Android Studio中使用已编译的SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆