配置eclipse使用我自己的Android SDK(framework.jar) [英] Configure eclipse to use my own Android SDK (framework.jar)

查看:21
本文介绍了配置eclipse使用我自己的Android SDK(framework.jar)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的设备制作了一个自定义的 framework.jar.这个新框架包括一个我想在我的应用程序中使用的新 API.不幸的是,除了我在 java 构建路径中包含了我自己的 framework.jar 之外,eclipse 没有看到我的新 API 并抛出编译时错误.如何配置 eclipse 以使用我的自定义 framework.jar 而不是 android SDK 中的 jar?

I made a custom framework.jar for my device. This new framework include a new API which I'd like to use in my apps. Unfortunately, besides I included my own framework.jar in java build path, eclipse didn't see my new API and throw compiling time errors. How can I configure eclipse to use my custom framework.jar instead of the jar within android SDK?

基于@Yuri 的回答和其他一些见解,我创建了一个工具(实际上它是一个 shell 脚本)来在 android SDK 中创建一个新平台并将 jar 文件合并到其中.它可以在 XDA 论坛中下载以及使用说明:http://forum.xda-developers.com/showthread.php?t=2619775

Based in @Yuri 's answer and some other insights, I created a tool (actually it is a shell script) to create a new platform in android SDK and merge jar files into it. It's available in XDA forums to download as well the instructions to use: http://forum.xda-developers.com/showthread.php?t=2619775

推荐答案

要构建 SDK,您应该运行以下命令:

To build SDK you should run the following commands:

make update-api
make sdk

由于Android的API已经修改,命令make update-api添加了新的API.命令 make sdkout 文件夹中创建 SDK.

Since the API of Android has been modified the command make update-api adds new API. The command make sdk creates SDK in out folder.

然后要开始使用新 SDK 在 Eclipse 中开发您的应用程序,您应该添加这个新 SDK.有 2 种可能性可以做到这一点.第一个来自嵌入式Android"一书.我直接复制到这里:

Then to start develop your applications in Eclipse using new SDK you should add this new SDK. There are 2 possibilities to do this. The first one is from the book "Embedded Android". I'll just copy it here:

假设你已经为Android开发配置了Eclipse使用 http://developer.android.com 上的说明,您需要执行两个额外的步骤来使用您新建的 SDK.第一的,您需要告诉 Eclipse 新 SDK 的位置.要这样做,去到Window→Preferences→Android,在里面输入新SDK的路径SDK 位置"框,然后单击确定".此外,出于不在撰写本文时,作者完全清楚,您还需要去窗口→Android SDK Manager",取消选择所有项目除了工具"下的前两个之外可能会被选中,然后单击安装 2 个包..."完成后,您将能够创建使用新 SDK 的新项目并访问您公开的任何新 API它.如果您不执行第二步,您将能够创建新的Android 项目,但没有一个会解析 Java 库正确,因此永远不会构建.

Assuming you had already configured Eclipse for Android development using the in‐ structions at http://developer.android.com, you’ll need to carry out two additional steps to use your newly-built SDK. First, you’ll need to tell Eclipse the location of the new SDK. To do so, go to Window→Preferences→Android, enter the path to the new SDK in the "SDK Location" box, and click OK. Also, for reasons that aren’t entirely clear to the author at the time of this writing, you also need to go to Window→"Android SDK Man‐ ager", deselect all the items that might be selected except the first two under "Tools" and click on "Install 2 packages..." Once that is done, you’ll be able to create new projects using the new SDK and access any new APIs you expose in it. If you don’t do that second step, you’ll be able to create new Android projects, but none of them will resolve Java libraries properly and will, therefore, never build.

至于这里的第二个是:

  1. 找到你新构建的 sdk zip(对于 Linux,可以在此处找到 cabout/host/linux-x86/sdk/)
  2. 将此包解压到文件夹中
  3. 在这个文件夹中你可以找到名为的目录platforms/android-2.3.3
  4. 将文件夹 android-2.3.3 重命名为
  5. 将此文件夹复制到以下安装位置您的 SDK 管理器:android-sdk-linux/platforms
  6. 在此文件夹中查找文件 build.prop 并分配给属性ro.build.version.sdk 任何负数:ro.build.version.sdk=-10
  7. 现在运行 SDK Manager,您会注意到添加了新的 sdk.只需创建新的 Eclipse 项目并选择此 sdk 作为目标.
  1. Find you new build sdk zip (for Linux it cab be found here out/host/linux-x86/sdk/)
  2. Unzip this pack into a folder
  3. Inside this folder you can find the directory which is called platforms/android-2.3.3
  4. Rename folder android-2.3.3 to <your_name>
  5. Copy this folder into the following location of the installation of your SDK Manager: android-sdk-linux/platforms
  6. Find inside this folder file build.prop and assign to the property ro.build.version.sdk any negative number: ro.build.version.sdk=-10
  7. Now run SDK Manager and you'll notice that you new sdk is added. Simply create new Eclipse project and select this sdk as a target.

这篇关于配置eclipse使用我自己的Android SDK(framework.jar)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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