android开发常见问题零碎点

1、  @android: 引用安卓内建的系统资源

android:background=“@android:drawable/ic_menu_delete”

2、  ?attr/: 引用应用内的属性资源

比如我在 styles 里定义了一个属性:

定义完之后,我就可以直接在 layout 中通过引用的方式去使用这个属性了:

android:background="?attr/colorReallyGreen"

3、  ?android: 引用系统内建的属性资源

4、app:和一般的android:

这两个是声明的不同的命名空间,android的是系统的,app是自定义的。

5、EditText去除下划线

android:background="@null"

6、ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.

解决方案:

把manifest.xml 里的sdk最小版本设置都删掉 Androidstudio3.0 以后 不能在manifest.xml 设置这些 必须在 gradle里设置/

7、Lint found fatal errors while assembling a release target的解决方案

解决方案;

在app的build.gradle中添加

android {    lintOptions {               abortOnError false    }}

8、Didn`t find class BasicHttpParams

原因: Apache Http 客户端弃用
        因为早在 Android 6.0 中,谷歌取消了对 Apache Http 客户端的支持。从 Android 9.0 开始, org.apache.http.legacy 将从 bootclasspath 中删除。

该修改对于大多数 taskVersion < 9.0 的应用没有影响,对所有 taskVersion > 9.0 的应用,如果继续使用 Apache Http 接口或者引用的 lib 包中用到该接口时,都会出现 Apache Http 接口找不到的异常。

解决方案:

在应用的 AndroidManifest.xml 文件的 中添加:

再次运行应用,完美运行。

 

 

9、Android studio MemoryLeakMonitor.jar is not exist!

华为手机调试性能优化,使用as的profiler时,无法选择memory的范围,报错信息。

原因:大概主要理解为华为部分手机出现的bug

解决:暂不知晓,换个手机就好了

 

10、 android debug卡在waiting for debugger,显示Could not connect to remote process. Aborting debug session

打开了多个IED,关闭其它的留下一个。就是打开了两个模拟设备,比如:一个手机,一个夜神模拟器。

或者

打开了DDMS 也要关掉

11、New Gradle Sync is not supported due to containing Kotlin modules using an unsupported plugin versio

gradle 配置的 kotlin插件版本和IDE(android-studio)中kotlin plugin版本不匹配,导致kotlin插件无法启用。

在android-studio中,kotlin是系统自带的plugins,android-studio根目录下plugins文件夹内的kotlin文件夹可看到

android开发常见问题_第1张图片

12、addView(View, LayoutParams) is not supported in AdapterView


==解决办法==:布局文件, 之间不要有任何节点 

13、Android Studio waiting for build to finish...


==解决办法==:Gradle损坏,重新同步gradle, File ->Sync Project with Gradle Files
或者 Ctrl ShiftA Sync Project With Gradle Files


14、文件找不到(cannot resolve symbol R)


原因是Intellij IDEA对单个文件的大小默认限制为2500kb, android studio是基于Intellij IDEA的;
解决方法就是进入android studio的安装目录 ,我的是 D:\Program Files\android-studio\bin ,将里面的idea.max.intellisense.filesize=2500数值更改为5000,重启AS就能解决了。android开发常见问题_第2张图片


15:安卓8以上无法显示通知


android开发常见问题_第3张图片
No Channel found for pkg=com.example.xx.xx, channelId=null, id=1001, tag=null…解决办法:android开发常见问题_第4张图片

源代码 //设置channel                NotificationChannel channel = new NotificationChannel("1",                        "mychannel", NotificationManager.IMPORTANCE_DEFAULT);                channel.enableLights(true);                channel.setLightColor(Color.GREEN);                notificationManager.createNotificationChannel(channel);                myBuilder.setContentTitle("叶良辰")                        .setContentText("我有一百种方法让你找不到bug")                        .setSubText("安卓8以上的通知需要设置channel!")                        .setTicker("收到叶良辰发来的消息")                        .setWhen(System.currentTimeMillis())                        .setSmallIcon(R.drawable.yinlian)                        .setLargeIcon(LargeBitmap)                        .setAutoCancel(true)                        .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE)                        .setContentIntent(pit)                        .setChannelId("1");


15 glide无法使用


android开发常见问题_第5张图片
最新版本配置环境
解决办法:
android开发常见问题_第6张图片
添加

    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
 

 

更多相关文章

  1. 关于ImageView的一些图片属性
  2. android中加载大图片到内存
  3. Android学习-RecyclerView默认scrollbar的相关属性
  4. 软键盘显示及属性android:windowSoftInputMode使用总结 & [转一

随机推荐

  1. 0412作业-购物车
  2. ssh隧道的特别使用--ssh跳板机的实现
  3. 数据库查询构造器
  4. 0628作业
  5. 给文本注册单击事件不起作用问题记录
  6. 在线QQ客服的固定定位以及三行三列的定位
  7. 你知道 JavaScript 中的 Arguments 对象
  8. HTML表格案例《商品信息表》
  9. 云计算未来的发展前景和就业前景怎么样?
  10. 微信授权扫码点餐-新特性React16