IDEA使用版本:2019版
问题一:
按步骤傻瓜式新建Android工程编译未通过,报错如下
import androidx.test.ext.junit.runners.AndroidJUnit4;
解决:
build.gradle(可以理解为一个Project框架,提供了对一个项目的基本配置)文件下,添加:
androidTestImplementation ‘androidx.test.ext:junit:1.1.1’
重新sync now
重新编译运行虚拟机,可正常运行。
问题二:
创建新项目XML文件报错:xmlns:android="http://schemas.android.com/apk/res/android“
作用:声明xml命名空间。xmlns意思为“xml namespace”.冒号后面是给这个引用起的别名。schemas是xml文档的两种约束文件其中的一种,规定xml中有哪些元素(标签)、元素有哪些属性及各元素的关系,当然从面向对象的角度理解schemas文件可以认为它是被约束的xml文档的“类”或称为“模板”。
解决:File - Settings - schemas and DtDs 中添加该路径:
android.content.res.Resources$NotFoundException: String resource ID #0xb
at android.content.res.Resources.getText(Resources.java:348)
at c.e.yanzhen.listview.maoAdapter.getView(maoAdapter.java:60)
解决:
item_age.setText(muserlist.get(position).getAge());
item_age.setText(muserlist.get(position).getAge()+"\t");