为 Android 构建启动器
我目前正在尝试修改 Android 2.2 froyo Home 应用程序。首先,我必须获取原始版本,对其进行编译并部署。
我认为这个应用程序称为 Launcher2。
我首先得到它:
git clone git://android.git.kernel.org/platform/packages/apps/Launcher2.git
可用的标签:
$ git tag
android-2.0.1_r1
android-2.0_r1
android-2.1_r1
android-2.1_r2
android-2.1_r2.1p
android-2.1_r2.1p2
android-2.1_r2.1s
android-2.2.1_r1
android-2.2.1_r2
android-2.2.2_r1
android-2.2_r1
android-2.2_r1.1
android-2.2_r1.2
android-2.2_r1.3
android-2.3.1_r1
android-2.3.2_r1
android-2.3.3_r1
android-2.3.3_r1.1
android-2.3.3_r1a
android-2.3.4_r0.9
android-2.3.4_r1
android-2.3.5_r1
android-2.3_r1
android-adt-0.9.8
android-adt-0.9.9
android-cts-2.1_r2
android-cts-2.1_r3
android-cts-2.1_r4
android-cts-2.1_r5
android-cts-2.2_r1
android-cts-2.2_r2
android-cts-2.2_r3
android-cts-2.2_r4
android-cts-2.2_r5
android-cts-2.2_r6
android-cts-2.2_r7
android-cts-2.3_r1
android-cts-2.3_r2
android-cts-2.3_r3
android-cts-2.3_r4
android-cts-2.3_r5
android-sdk-2.0.1-docs_r1
android-sdk-2.0.1_r1
android-sdk-2.0_r1
android-sdk-2.1_r1
android-sdk-2.2_r1
android-sdk-2.2_r2
android-sdk-2.3.4_r1
android-sdk-adt_r12
android-sdk-tools_r12
android-sdk-tools_r3
android-sdk-tools_r4
android-sdk-tools_r5
android-sdk-tools_r6
android-sdk-tools_r7
我切换到 android-2.2_r1:
$ git checkout android-2.2_r1
Note: checking out 'android-2.2_r1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 279302e... Merge branch 'froyo' into froyo-release
现在,如果我尝试使用 Eclipse 构建代码,我会遇到很多错误。引起我注意的是,这个 Launcher2 使用的是“android.renderscript”,该脚本仅在 Api 级别 11 后可用(renderscript 参考) - Froyo 的 Api 级别为 8。
$ grep -R renderscript *
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Allocation;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Element;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ProgramFragment;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ProgramStore;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ProgramVertex;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.RSSurfaceView;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.RenderScriptGL;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.RenderScript;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Sampler;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Script;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ScriptC;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.SimpleMesh;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Type;
我想我的结帐一定有问题。从Api-Levels,我猜我签出的版本一定是针对的安卓3.0!
任何帮助解决这个问题都会很棒!
I'm currently trying to modify Android 2.2 froyo Home app. To begin, I must get the original, compile it and deploy it.
I think that this app is called Launcher2.
I started by getting it:
git clone git://android.git.kernel.org/platform/packages/apps/Launcher2.git
The available tags:
$ git tag
android-2.0.1_r1
android-2.0_r1
android-2.1_r1
android-2.1_r2
android-2.1_r2.1p
android-2.1_r2.1p2
android-2.1_r2.1s
android-2.2.1_r1
android-2.2.1_r2
android-2.2.2_r1
android-2.2_r1
android-2.2_r1.1
android-2.2_r1.2
android-2.2_r1.3
android-2.3.1_r1
android-2.3.2_r1
android-2.3.3_r1
android-2.3.3_r1.1
android-2.3.3_r1a
android-2.3.4_r0.9
android-2.3.4_r1
android-2.3.5_r1
android-2.3_r1
android-adt-0.9.8
android-adt-0.9.9
android-cts-2.1_r2
android-cts-2.1_r3
android-cts-2.1_r4
android-cts-2.1_r5
android-cts-2.2_r1
android-cts-2.2_r2
android-cts-2.2_r3
android-cts-2.2_r4
android-cts-2.2_r5
android-cts-2.2_r6
android-cts-2.2_r7
android-cts-2.3_r1
android-cts-2.3_r2
android-cts-2.3_r3
android-cts-2.3_r4
android-cts-2.3_r5
android-sdk-2.0.1-docs_r1
android-sdk-2.0.1_r1
android-sdk-2.0_r1
android-sdk-2.1_r1
android-sdk-2.2_r1
android-sdk-2.2_r2
android-sdk-2.3.4_r1
android-sdk-adt_r12
android-sdk-tools_r12
android-sdk-tools_r3
android-sdk-tools_r4
android-sdk-tools_r5
android-sdk-tools_r6
android-sdk-tools_r7
I switched to android-2.2_r1:
$ git checkout android-2.2_r1
Note: checking out 'android-2.2_r1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 279302e... Merge branch 'froyo' into froyo-release
Now, if I try to building the code using Eclipse I get lots of erros. One that got my attention was that this Launcher2 is using the "android.renderscript" that is only available since Api level 11 (renderscript reference) - Froyo is Api level 8.
$ grep -R renderscript *
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Allocation;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Element;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ProgramFragment;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ProgramStore;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ProgramVertex;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.RSSurfaceView;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.RenderScriptGL;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.RenderScript;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Sampler;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Script;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.ScriptC;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.SimpleMesh;
src/com/android/launcher2/AllApps3D.java:import android.renderscript.Type;
I guess that my checkout must have something wrong. From Api-Levels, I guess that the version I checkeout must be for Android 3.0!
Any help solving this would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,RenderScript 存在于 2.2 中(Google 动态壁纸使用它,显然家庭应用程序也使用它),它只是不是公共(所以它不是 SDK 的一部分 - 它只能使用通过内部应用程序)。
他们用很多应用程序来做到这一点。例如,我曾经尝试从 AOSP 构建音乐应用程序,但因类似问题而失败(我缺少一些不在 SDK 中但在源代码中的包)。我没有时间去弄清楚,所以我停在那里。
不过,我有一些建议给您:
Actually, RenderScript is present in 2.2 (the Google live wallpapers use it, and apparently the home app as well), it's just not public (so it's not part of the SDK -- it can only be used by internal apps).
They do this with a lot of apps. For example, I once tried to build the Music app from the AOSP and failed with a similar issue (I was missing some package that was not in the SDK but was in the source). I didn't have the time to figure it out so I stopped there.
However, I have a couple of suggestions for you: