配置我的项目合适Android的API级别 [英] Configuring the right Android-API level for my project

查看:170
本文介绍了配置我的项目合适Android的API级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序要针对的所有Android版本> = 8 (需要推通知),但我有一个很难理解的API /依存关系的正确组合,我需要为我的项目设置。

该项目将需要基于位置的服务谷歌的API,我需要/想使用 ActionBarSherlock 以动作条支持。

这是设置是否正确?


AndroidManifest.xml中:

(1)


 <采用-SDK
    安卓的minSdkVersion =8
    机器人:targetSdkVersion =16/><应用
    机器人:主题=@风格/ Theme.Sherlock.Light>
    ...


利布斯:

(2)
我加了 Android的支持 - v4.jar

项目属性:

(3)
设置为谷歌的API 16

ActionBarSherlock:

(4)
我跟在动作条-FAQ视频,设置了ABS作为库项目,我有它在其项目设置proberties到Android 16级,并且加入 Android的支持 - v4.jar 在lib文件夹中。


我知道这是怎样的一个基本的问题,但我不知道如果我选择了正确的设置。我特别想知道,或如果(3)是正确的,如果我应该设置全局API级到8?

更新1 :我也有理解 support.jar 的机制问题。如果我把我的构建目标为最大 - 系统怎样确保高水平的功能(如碎片)较低的API(如8)工作。这是自动的做,还是我不得不手动美元,而支持包C $ C吗?
更新2 关于 support.jar 我要知道我使用什么功能,将不得不对support.jar code。如果我失败了,并使用一种特性,它太超前了,在较低的API水平,则抛出ClassCastException ...?

任何帮助AP preciated。另外:我是个初学者,所以有一些背景资料的答案将高度重视:)

谢谢!


解决方案

这看起来正确。正如在ActionBarSherlock.com视频描述你希望你的步骤#3设置为最高的工程建设目标供您ActionBarSherlock版本。所以,如果你有ABS 4.1.0,你要平台4.1,API 16。

您是否还成立了ABS项目作为库?你的项目的依赖应该有两个:


  • <您-ABS库>的.jar

  • Android的支持 - v4.jar

In my application I want to target all Android Versions >= 8 (Push-Notification required), but I'm having a hard time understanding the right combination of APIs / dependencies I need for my project setup.

The project will need Google APIs for location based services, and I need to / want to use ActionBarSherlock for ActionBar support.

Is this setup correct?


AndroidManifest.xml:

(1)

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

<application
    android:theme="@style/Theme.Sherlock.Light" >
    ...

Libs:

(2) I added android-support-v4.jar

Project-properties:

(3) Set to Google-APIs 16

ActionBarSherlock:

(4) I followed the video at ActionBar-FAQ to set-up ABS as a library project, and I have it set to Android Level 16 in its project proberties, and added android-support-v4.jarin its lib folder.


I know it's kind of a basic question, but I'm not sure if I've chosen the right setup. I'm especially wondering if (3) is correct or if I am supposed to set the overall API-Level to 8?

Update 1: I also have a problem understanding the mechanisms of support.jar. If I set my build-target to maximum - how does the system make sure that high-level functionality (like fragments) work in lower APIs (like 8) . Is this done automagically, or do I have to manually code against support packages? Update 2 Regarding support.jar I will have to know what features I'm using and will have to code against support.jar. If I fail and use a feature which is too advanced, a ClassCastException on lower API levels will be thrown...?

Any help appreciated. Also: I'm a beginner, so answers with some background information would be highly regarded :)

Thanks!

解决方案

That looks right. As described in the video on ActionBarSherlock.com you want your step #3 set to the highest "Project Build Target" available for your version of ActionBarSherlock. So if you have ABS 4.1.0, you want Platform 4.1, API 16.

Have you also set up the ABS project as a library? Your project's dependencies should have both:

  • < Your-ABS-Library >.jar
  • android-support-v4.jar

这篇关于配置我的项目合适Android的API级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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