笔记10--遇到的错误
来源:互联网 发布:linux修改系统日期 编辑:程序博客网 时间:2024/04/30 07:59
1、activity未注册
protected void onCreate(Bundle savedInstanceState) {
// TODO 自动生成的方法存根
super.onCreate(savedInstanceState);
但是若改成系统生成的,就正常了。原因是未在AndroidMainfest.xml文件注册Activity。
正好说下怎么新建Activity:
1)新建一个类,继承自android.app.Activity类。2)创建一个xml文件3)打开AndroidMainfest.xml,注册Activity。直接写源码吧:
<activity android:name="cn.test.mallApp.activity.OrderDetailsActivity" android:launchMode="singleTask"></activity>
2、Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.Failed to find style 'textViewStyle' in current theme
网上给出的一种解决方法:XML图形界面 右上角Theme选择 Theme或者Theme.Black
当然,如果你的工程原来没这个问题,就直接clean下就好了。3、Activity not started, its current task has been brought to the front:这种情况只需重启adb。
4、ScrollView遇到的一个问题:ScrollView can host only one direct child。
解决方法:主要是ScrollView内部只能有一个子元素,所以需要把所有的子元素放到一个LinearLayout或RelativeLayout等其他布局方式中。
5、the parent child already has a parent .You must call removeVie() on the child's parent first:
原因是要添加的控件本来就有一个父类了,现在又要给他增加一个父类,java不支持多继承的,所以肯定报错。解决方法:1)要么动态写一个控件。2)要么添加控件的父类,而不是控件本身。
6、端口被占用:“Please ensure that adb is correctly located at 'E:/src/android23sdk/android-sdk_r08-windows/android-sdk-windows/platform-tools' and can be executed.”
这种情况是端口被占用。思路:先找到adb用哪个端口,然后找到该端口被哪个进程占用,最后结束该进程。
1)要想知道adb用哪个端口,必须先将adb.exe路径(一般都sdk\platform-tools\)加入path中,否则无法在cmd中操作它。
OK,加入path后,在cmd中输入adb nodaemon server 。就知道adb用哪个端口了。
2)继续输入netstat -ano | findstr "5037" ,找到占用该端口的pid值。继续输入:tasklist|findstr "6540",可知哪个进程占用了该端口。
3)任务管理器中结束该进程。
7、错误信息:FATAL EXCEPTION MAIN:java.lang.ClassCastException:android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams.可能原因:1)布局参数错误2)跟错误5相同原因。
8、空指针异常:1)定义对象,未实例化。举例:List<List<Bitmap>> childGoodsIcon=null;然后直接给他赋值了。应该先List<List<Bitmap>> childGoodsIcon=new ArrayList<List<Bitmap>> childGoodsIcon;
- 笔记10--遇到的错误
- C++遇到的错误解决笔记
- 我的C++程序遇到的错误---纯属个人笔记
- Hbase遇到master is initializing的错误(笔记)
- 【pyhton学习笔记】历数那些遇到的错误
- ImageView 设置背景时我遇到的一个错误笔记
- tensorflow学习笔记:运行tensorboard遇到的错误
- 今天遇到的错误
- 遇到的hibernate错误
- java遇到的错误
- java遇到的错误
- && ||遇到的错误
- 遇到的变态错误
- 编译遇到的错误
- 遇到的错误
- Spring遇到的错误
- wp 遇到的错误
- 今天遇到的错误
- 中国移动“逆天”套餐-香港3g-LTE套餐 之拙见
- 达内科技IPO首日微涨0.67%
- 大数据时代下的SQL Server第三方负载均衡方案 ----Moebius测试
- 二分搜索:lower_bound, upper_bound
- jaxb Element下怎么设置多个同名的子Element
- 笔记10--遇到的错误
- 海力士camera
- POJ 1001 & UVa 748 - Exponentiation in JAVA
- Java中反射性能测试
- Spring + iBatis 的多库横向切分简易解决思路
- 守护进程
- Andriod 存储数据方式 之 SharedPreferences
- 23种设计模式之python实现--代理(Proxy)模式
- Linux环境下使用vsftpd搭建ftpd服务器