本文介绍了在 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 路径的 SO 问题.路径更改后我遇到了问题.我编译的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文件夹确实有一个build tools文件夹)

(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 -->platforms/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 sync 再次启动,并打印日志中的以下内容(然后保持卡住):

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:41