安卓初学者关于在setContentView(..)出现source not found 的问题
2014-06-24 14:43
127 查看
这也是今天遇到的一个问题。对于新手来说,或许也算情有可原!
当我将新代码加入项目进行手机调试时,开始出现source not found 的错误,断点进入调试,发现出居然出现在setContentView(R.layout.sh_query_price);这句代码里。
locat中找到错误:Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.button" on path: DexPathList[dexElements=[zip file "/data/app/com.example.biaochengmobile-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.biaochengmobile-1,
/vendor/lib, /system/lib]]。而下面这一段是我.xml布局文件里的一段代码,
<button
android:id="@+id/button_query"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_selector_log"
android:layout_marginTop="16dp"
android:text="查询" />
<Button
android:id="@+id/button_reset"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_selector_log"
android:layout_marginTop="16dp"
android:text="重置" />
很显然,button首字母的小写导致了这个错误,因为默认情况下都是大写的。
当我将新代码加入项目进行手机调试时,开始出现source not found 的错误,断点进入调试,发现出居然出现在setContentView(R.layout.sh_query_price);这句代码里。
locat中找到错误:Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.button" on path: DexPathList[dexElements=[zip file "/data/app/com.example.biaochengmobile-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.biaochengmobile-1,
/vendor/lib, /system/lib]]。而下面这一段是我.xml布局文件里的一段代码,
<button
android:id="@+id/button_query"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_selector_log"
android:layout_marginTop="16dp"
android:text="查询" />
<Button
android:id="@+id/button_reset"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_selector_log"
android:layout_marginTop="16dp"
android:text="重置" />
很显然,button首字母的小写导致了这个错误,因为默认情况下都是大写的。
相关文章推荐
- 关于在新建的package中用SetContentView()函数时无法找到已创建的R.layout的布局文件的的问题的解决办法
- 关于使用android Eclipse按ctrl+鼠标左键或者F5出现source not found的问题如何解决
- 关于MyEclipse查看底层源码出现source not found的问题(MyEclipse、Eclipse配置JAD)
- 问题记录之Activity的继承类的继承类覆盖的onCreate()函数,无法成功setContentView
- 关于AutoCompleteTextView 为什么必须输入两个字符才能出现补全提示的问题的解决办法
- 关于安卓高版本访问网络出现.NetworkOnMainThreadException异常的问题 .
- 关于TableView中出现deallocated问题
- eclipse+CDT+cygwin调试时出现Source not found问题
- cell中button怎么得到对应cell的indexpath 以及关于UITableViewCellContentView的问题
- 手机页面转换--关于setContentView的应用
- 关于TableView中出现deallocated问题
- 【android】关于使用ViewPager和LayoutInflater的出现问题
- 安卓开发_关于WebView加载页面空白问题
- 关于TabActivity+ViewFlipper组合使用出现的问题
- 关于WebView的addJavascriptInterface方法的安卓版本问题
- cell中button怎么得到对应cell的indexpath 以及关于UITableViewCellContentView的问题
- 关于AutoCompleteTextView 为什么必须输入两个字符才能出现补全提示的问题的解决办法
- 安卓 setContentView使用
- 关于安卓高版本访问网络出现.NetworkOnMainThreadException异常的问题
- 关于AlertDialog.getWindow().setContentView(view)不能弹出输入法