========================================================================================================

注:

本文内容转载自互联网,仅供个人学习之用!

========================================================================================================

(1)  Application does not specify an API level requirement!

在运行Android程序时,有时候会出现以下提示



[2010-05-28 19:03:03 - rss_reader]WARNING: Application does not specify an API level requirement!

[2010-05-28 19:03:03 - rss_reader]Device API version is 12 (Android 3.1)

其中Android 3.1表示工程使用的Androidsdk版本,示例中使用的是3.1版本;12是设备的API版本,出现该提示,是因为工程中没有配置设备API版本,只需要在文件AndroidManifest.xml中添加上相应的配置信息即可。

    示例如下:

<manifest ……>

    <application ……">

        ……

    </application>

    <uses-sdk android:minSdkVersion="12"></uses-sdk>

</manifest>

注意,红字部分是采用的设备API版本号;users-sdk节点同application节点在同一级别。

(2)  显示尺寸的单位:

Difference
between px, dp, dip and sp in Android?

LinkTo:http://stackoverflow.com/questions/2025282/difference-between-px-dp-dip-and-sp-in-android

px is one pixel. scale-independent pixels ( sp )
and density-independent pixels ( dip )
you want to use sp for font sizes and dip for everything else.

dip==dp

from here http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

px

Pixels - corresponds to actual pixels on the screen.

in

Inches - based on the physical size of the screen.

mm

Millimeters - based on the physical size of the screen.

pt

Points - 1/72 of an inch based on the physical size of the screen.

dp

Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not
necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

sp

Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

(3)  R资源丢失的问题:

Android: R cannot be resolved to a variable

转载自:http://hi.baidu.com/mycollection/item/5f62fbeada78120d65db00ac

Android开发过程中,碰到R cannot be resolved to a variable的报错信息,好像没有很确定的错误原因,一般来说,我总结出几个可能的解决方法,希望试过以后管用。。。

1. 检查Android 的SDK是否丢失需要重新下载,检查build path

2.确保class没有import Android.R;

3,错误class引用的layout的xml文件没有错误

4.检查AndroidManifest.xml文件,里边的package,layout配置文件,strings.xml等的字符串全部书写正确

5.layout的xml文件中引用的strings.xml中的字符串拼写完全正确

6.在layout 的xml文件手写添加一个控件,看id能否在R.java中自动生成,如果不能,那很大可能就是这个layout 的xml文件有问题,查看格式是否使用正确,或者包含什么非法字符串,或者调用到了不正确的字符串,等等,可以使用排除法,挨个去掉控件,直到发现error message消失或者id能在R.java中自动生成。

7.删掉gen文件夹,使R.java重新自动生成一次,如果不能生成,继续检查layout的xml文件是否有如上不易发觉的问题

8.Clean project ,重新build,或者重新import project。

9.重启eclipse

10.重启电脑,以防Android 虚拟机的问题

另注:

当引用资源变量时,如R.string.bluetooth_name,编译程序失败,提示如“bluetooth_name cannot be resolved or is not a field..."之类的错误提示,

a)  需要检查源文件是否被误加入“import android.R;”类似的语句,如有则删除该语句,重新编译程序,看是否编译通过;

b) 编辑./res/values/strings.xml文件,修改部分文字并保存,重新编译程序项目;

========================================================================================================

注:

本文内容转载自互联网,仅供个人学习之用!

========================================================================================================

(1)  Application does not specify an API level requirement!

在运行Android程序时,有时候会出现以下提示



[2010-05-28 19:03:03 - rss_reader]WARNING: Application does not specify an API level requirement!

[2010-05-28 19:03:03 - rss_reader]Device API version is 12 (Android 3.1)

其中Android 3.1表示工程使用的Androidsdk版本,示例中使用的是3.1版本;12是设备的API版本,出现该提示,是因为工程中没有配置设备API版本,只需要在文件AndroidManifest.xml中添加上相应的配置信息即可。

    示例如下:

<manifest ……>

    <application ……">

        ……

    </application>

    <uses-sdk android:minSdkVersion="12"></uses-sdk>

</manifest>

注意,红字部分是采用的设备API版本号;users-sdk节点同application节点在同一级别。

(2)  显示尺寸的单位:

Difference
between px, dp, dip and sp in Android?

LinkTo:http://stackoverflow.com/questions/2025282/difference-between-px-dp-dip-and-sp-in-android

px is one pixel. scale-independent pixels ( sp )
and density-independent pixels ( dip )
you want to use sp for font sizes and dip for everything else.

dip==dp

from here http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

px

Pixels - corresponds to actual pixels on the screen.

in

Inches - based on the physical size of the screen.

mm

Millimeters - based on the physical size of the screen.

pt

Points - 1/72 of an inch based on the physical size of the screen.

dp

Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not
necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

sp

Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

(3)  R资源丢失的问题:

Android: R cannot be resolved to a variable

转载自:http://hi.baidu.com/mycollection/item/5f62fbeada78120d65db00ac

Android开发过程中,碰到R cannot be resolved to a variable的报错信息,好像没有很确定的错误原因,一般来说,我总结出几个可能的解决方法,希望试过以后管用。。。

1. 检查Android 的SDK是否丢失需要重新下载,检查build path

2.确保class没有import Android.R;

3,错误class引用的layout的xml文件没有错误

4.检查AndroidManifest.xml文件,里边的package,layout配置文件,strings.xml等的字符串全部书写正确

5.layout的xml文件中引用的strings.xml中的字符串拼写完全正确

6.在layout 的xml文件手写添加一个控件,看id能否在R.java中自动生成,如果不能,那很大可能就是这个layout 的xml文件有问题,查看格式是否使用正确,或者包含什么非法字符串,或者调用到了不正确的字符串,等等,可以使用排除法,挨个去掉控件,直到发现error message消失或者id能在R.java中自动生成。

7.删掉gen文件夹,使R.java重新自动生成一次,如果不能生成,继续检查layout的xml文件是否有如上不易发觉的问题

8.Clean project ,重新build,或者重新import project。

9.重启eclipse

10.重启电脑,以防Android 虚拟机的问题

另注:

当引用资源变量时,如R.string.bluetooth_name,编译程序失败,提示如“bluetooth_name cannot be resolved or is not a field..."之类的错误提示,需要检查源文件是否被误加入“import android.R;”类似的语句,如有则删除该语句,重新编译程序即可正常。

[置顶] Android Journal的更多相关文章

  1. [置顶] Android开发笔记(成长轨迹)

    分类: 开发学习笔记2013-06-21 09:44 26043人阅读 评论(5) 收藏 Android开发笔记 1.控制台输出:called unimplemented OpenGL ES API ...

  2. [置顶] Android AlarmManager实现不间断轮询服务

    在消息的获取上是选择轮询还是推送得根据实际的业务需要来技术选型,例如对消息实时性比较高的需求,比如微博新通知或新闻等那就最好是用推送了.但如果只是一般的消息检测比如更新检查,可能是半个小时或一个小时一 ...

  3. [置顶] [Android源码分析]inquiry result引起的上层变化分析

    在上一篇文章中,我们详细分析了android是如何解析蓝牙反馈上来的搜索到的设备信息,本文将会继续分析这些信息到了上层之后是如何处理. 8.inquiry result引起的上层变化 我们知道inqu ...

  4. [置顶] Android四大组件之BroadcastReceiver

    Android四大组件之BroadcastReceiver Broadcast Receiver 广播接收器,是一种负责接收广播消息并对消息做出响应的组件,和Service一样并不提供与用户交互的UI ...

  5. [置顶] Android图片异步加载之Android-Universal-Image-Loader

    将近一个月没有更新博客了,由于这段时间以来准备毕业论文等各种事务缠身,一直没有时间和精力沉下来继续学习和整理一些东西.最近刚刚恢复到正轨,正好这两天看了下Android上关于图片异步加载的开源项目,就 ...

  6. [置顶] Android 状态栏那些小坑?

    背景:因为之前老板上次问我我们的app能不能自定义上面的状态栏我说可以啊!当时没管,今天试了下果然很多坑,之前github上也有很多大佬写了一个开源库有兴趣的可以点进去看下支持DrawLayout沉侵 ...

  7. [置顶] Android 适配真要命?

    原始尺寸场景 相信大家对上面也有所有耳闻另外就是如何计算屏幕的密度一般都是按照勾股定理例如中等屏幕密度 480^2+800^2开根号 然后除以当前屏幕尺寸3.5-4.2之间尺寸. 对于刚出来的那些An ...

  8. [置顶] Android 2016新技术

    版权声明:分享技术,传播快乐.如果本博客对你有帮助,请在我的博客首页为我打赏吧! 2016你需要了解Android有以下新兴的技术与框架,有些也许还不成熟,但是你应该去了解下,也许就是未来的方向. K ...

  9. [置顶] Android应用开发之版本更新你莫愁

    传送门 ☞ 轮子的专栏 ☞ 转载请注明 ☞ http://blog.csdn.net/leverage_1229 今天我们学习如何实现Android应用的自动更新版本功能,这是在各种语言编写的应用中都 ...

随机推荐

  1. PPTP、L2TP、IPSec和SSLVPN的区别

    VPN (虚拟专用网)发展至今已经不在是一个单纯的经过加密的访问隧道了,它已经融合了访问控制.传输管理.加密.路由选择.可用性管理等多种功能,并在全球的信息安全体系中发挥着重要的作用.也在网络上,有关 ...

  2. Android5.0之Toobar的使用

    总体上来说,Toolbar的使用可以分为两个方面,一方面是将ToolBar当作ActionBar来用,另一方面就是将Toolbar当成一个单独的控件来用,不过到目前为止我见到的大部分情况都是把Tool ...

  3. 关于ComponentName的使用

    ComponentName,顾名思义,就是组件名称,通过调用Intent中的setComponent方法,我们可以打开另外一个应用中的Activity或者服务. 实例化一个ComponentName需 ...

  4. ModelAndView使用方法

    配置支持ModelAndView 在application.xml中配置支持ModelAndView,配置方式有两种. 配置一 <bean id="ViewResolver" ...

  5. Java动态绑定

    1. 动态绑定 将一个方法调用同一个方法主体关联起来被称作绑定. 在运行时根据对象的类型进行绑定,叫做后期绑定或运行时绑定.Java中除了static方法和final 例如,下面定义了一个Shape类 ...

  6. Android 頁面中有 EditText ,進入時取消自動彈出鍵盤

    Android 畫面裡的 EditText 被 Focus 時 會自動彈出鍵盤 這是方便使用者習慣的設計 不過筆者在開發時發現 有時候方便過頭了 原因 一開始進入有 EditText 的頁面時 Edi ...

  7. 介绍SmartUpload很好的网站

    附带链接:http://www.cnblogs.com/elleniou/archive/2012/09/24/2700583.html

  8. 20160331javaweb之JSP 标签技术

    jsp的标签技术:在jsp页面中最好不要出现java代码,这时我们可以使用标签技术将java代码替换成标签来表示 1.jsp标签:sun原生提供的标签直接在jsp页面中就可以使用 <jsp:in ...

  9. php安全模式

    http://www.cnblogs.com/samson/archive/2011/08/08/2130550.html php安全模式:safe_mode=on|off启用safe_mode指令将 ...

  10. Android出现Read-only file system 解决方法

    操作AVD文件系统上的文件时遇到"... Read-only file system". 解决办法: 将AVD sdcard挂载为读写权限: 在doc下执行:adb -s emul ...