android 开发中遇到的问题及解决方法
2012-01-31 17:20
411 查看
转自:http://blog.163.com/smilecatflower_18z/blog/static/1926270452011102523921331/
2011-11-25 14:46:12| 分类:android | 标签:开发问题及解决
|字号大中小 订阅
1.导入含有第三方jar包的项目时,无法定位项目中的jar包,“This will not be added to the package."
解决方法:
右击项目--->BuildPath-->Configuration Build Path--> 选中右侧的”Libraries“标签-->选中带有红叉的jar包并Remove;
然后单击”Add JARs“,找到该jar包在本项目中的位置就可以了。
如果运行后出现”Could not find .apk“,可以重新导入项目就可以了。
关于Could not find xxx.apk可
参考:http://blog.csdn.net/johee/article/details/5521310
2.“gen already exists but is not a source folder. Convert to a source folder or rename it”
右击项目选"Properties"-->在左侧选中"Java Build Path"-->打开右侧的“Source”标签-->单击"Add
Folder..."-->在弹出的对话框中选中 "gen" ,点击ok,ok;
右击项目选"Andriod Tools" -->选中单击"Fix
Project Properties"
以下是英文说明:
Right click on the project and go to "Properties
Select "Java Build Path" on the left
Open "Source" tab
Click "Add Folder..."
Check "gen" folder and click Ok and Ok again
Again right click on the project and in the "Andriod Tools" click on "Fix Project Properties"
来自逆流的鱼的百度空间
http://hi.baidu.com/flash_fish/blog/item/0237e11dc86c529786d6b60b.html
3.ActivityManager:
java.lang.SecurityException: Permission Denial: starting Intent
最近在调试程序的时候经常出现ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.xxxxx.xxxxx/.ui.xxxxxxx } from null (pid=-1, uid=-1) requires null的问题,困扰我好几天了,一开始只是认为权限的问题,跟了好久一直没有解决。 后来看到: The java.lang.SecurityException you are seeing is because you may enter two entries pointing to same activity. Remove the second one and you should be good to go. 才发现这个Activity在Manifest文件里写了两份,去掉一份后,终于可以正常运行了。 注:此问题还会引起,在手机端点击程序图标时,会提示程序未安装在手机上。 |
4.java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
调用截图方法时应用强制退出:public Bitmap takeScreenShot(Activity activity){
//View是你需要截图的View
View view
= activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
b1
= view.getDrawingCache();
//获取状态栏高度
Rect frame
=
new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight
= frame.top;
//获取屏幕长和高
int width
= activity.getWindowManager().getDefaultDisplay().getWidth();
//去掉标题栏
b
= Bitmap.createBitmap(b1,
0, statusBarHeight,
350, b1.getHeight()-statusBarHeight);
view.destroyDrawingCache();
return b; }
解决方法:
x + width must be <= bitmap.width()宽度超出了你要截的图的宽度~width改成b1.getWidth()
来自:http://topic.csdn.net/u/20111031/10/4472919e-4653-4d5f-b9ae-b66277823ee5.html
5.Activity XXXX(项目名) has leaked ServiceConnection
解决方法:
在onDestory方法里解除绑定服务就ok,解除绑定后服务还是可以运行的。
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
this.unbindService(conn);
super.onDestroy();
}
相关文章推荐
- Android ble蓝牙4.0开发遇到的问题及解决方法
- Android开发中遇到的adb问题解决方法
- [原]用Eclipse开发Android应用,用svn管理源码时遇到的问题及解决方法
- Android Studio-—使用OpenCV的配置方法和demo以及开发过程中遇到的问题解决
- Android开发中遇到端口号占用问题解决方法
- Android遇到的各种问题(一)——开发中Theme.AppCompat.Light的解决方法
- Android开发中遇到的问题(四)——Android中WARNING: Application does not specify an API level requirement!的解决方法
- android开发环境遇到adt无法启动的问题分析及解决方法
- 开发Android的时候遇到的问题及解决方法(不断更新)
- 最近开发android app时遇到问题和解决方法
- Eclipse开发Android应用时遇到的问题以及解决方法
- 【Android】android开发过程遇到的问题以及解决方法总结
- Android开发中遇到的问题(四)——Android中WARNING: Application does not specify an API level requirement!的解决方法
- android开发中遇到的问题解决之RelativeLayout执行measure(w,h)方法时,出现NullPointerException的异常情况
- Android开发中遇到的问题(四)——Android中WARNING: Application does not specify an API level requirement!的解决方法
- android 开发中遇到的问题及解决方法
- Android开发环境搭建时遇到问题的解决方法
- 关于Android开发导入已有项目遇到Project has no default.properties file! Edit the project properties to set one.问题的解决方法
- android 开发中遇到的问题及解决方法
- Android;Share SDK微信分享中遇到的问题以及解决方法