Android 错误集合
1. Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
解决:
在工程的gradle.properties文件中添加以下命令:
android.enableAapt2=false
2. java.net.ProtocolException: Unexpected status line: <html>
原因:
在网络请求的 url 地址上所带参数 password 通过 Base64.DEFAULT 加密后,带有 \n 换行符,即参数的问题导致该问题。
解决:
通过 Base64.NOWRAP 去掉换行后,错误解决。
3. java.lang.IllegalStateException:Not allowed to start service Intent : app is in background uid UidRecord

Android 8.0 不再允许后台service直接通过startService方式去启动,我们需要 context.startService()替换为context.startForegroundService();
Intent i = new Intent(context, MediaPlaybackService.class);
context.startForegroundService(i, CURRENT);
在 MediaPlaybackService 的 onCreate()方法 设置为前台进程:
public void onCreate() {
super.onCreate();
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// notification id
final String channelId = MusicBrowserActivity.MUSIC_NOTIFICATION_CHANNEL;
// create notification channel
NotificationChannel mChannel = new NotificationChannel(channelId, "MUSIC", NotificationManager.IMPORTANCE_LOW);
mNotificationManager.createNotificationChannel(mChannel);
// set channel id
Notification status = new Notification.Builder(MediaPlaybackService.this).setChannelId(channelId).build();
// start for foreground process
startForeground(PLAYBACKSERVICE_STATUS, status);
}
4. Faild to post notification on channel "null"
NotificationChannel 是 android8.0 新增的特性,如果App的 targetSDKVersion >= 26,没有设置 channel 通知渠道的话,就会导致通知无法展示。
解决: 创建 Channel
String channelID = "1";
String channelName = "channel_name";
NotificationChannel channel = new NotificationChannel(channelID, channelName, NotificationManager.IMPORTANCE_HIGH);
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
Notification.Builder builder = new Notification.Builder(context);
builder.setContentText(msgDesc);
builder.setContentTitle(msgTitle);
//创建通知时指定channelID
builder.setChannelId(channelID);
Notification notification = builder.build();
上面代码是针对android8.0,我们还要兼容低版本系统以及channel属性设置。
5. found an invalid color. java.util.concurrentException:com.android.builder.interal.aapt.v2.Aapt2Exception: AAPT2 error

出现这个问题的原因是项目中引入了一个 .9 图片引起的,需要更改一下.9图片的四边的黑线(拉长或者缩短都可以)。
6. No signature of method: static org.gradle.api.java.archives.Manifest.srcFile() is applicable for argument types: (java.lang.String) values ...

7. Kotlin compiler:
Unresolved reference: BaseApplication
'onCreate' overrides nothing

场景: 在 common 组件里放置 BaseApplication 或者 BaseActivity ,在其他 module 中继承出现这个问题。原因是 common 组件未配置 kotlin
解决: 在 common 的 build.gradle 最上方添加:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
8. javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
导致这个问题的原因就是 密钥不对 ,要严格按照密钥的生成规则
9. Error: Program type already present: ****** .BuildConfig
Android studio Throwing the wrong way is because 2 module have the same package name in AndroidManifest.xml, and can modify different names. 这个问题是出现在 Android 4.x ,在Android 5.x以上就没有问题了。根本原因未探索
解决: 将相同包名中的其中一个改成其他报名
10. java.lang.IllegalArgumentException: Unknown pattern character 'X'
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX" 使用该格式转化时间格式,出现问题 。测试:Android6.0 以及 Android4.4上均出现问题。 原因:X is available only from Nougat+.
苟且解决方案: 将 "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" 改为 "yyyy-MM-dd'T'HH:mm:ss.SSS"
. io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with.
解决:
//RxJava2 取消订阅后,抛出的异常无法捕获,导致程序崩溃
RxJavaPlugins.setErrorHandler {
LogUtil.e(it.message ?: "RxJavaError")
}
Android 错误集合的更多相关文章
- Android --资料集合
google android 官方教程 http://hukai.me/android-training-course-in-chinese/basics/index.html android视频资料 ...
- Gradle DSL method found: ‘android()’错误
Gradle DSL method found: ‘android()’错误 和上个错误一样这个也是因为在新版本的Gradle中android()方法已经废弃,但是要注意android()只是在整个项 ...
- Android icons集合
Android icons集合: Be aware that the style changes occur fairly regularly with each major release, so ...
- Android - 错误:"No resource found that matches the given name android:Theme.Material"
Android - 错误:"No resource found that matches the given name android:Theme.Material" 本文地址: ...
- springboot整合mybatis步骤以及错误集合
1.首先在springboot项目中的pomx文件引入官方的依赖 <groupId>org.mybatis.spring.boot</groupId> <artifact ...
- 【Android应用开发】Android Studio 错误集锦 -- 将所有的 AS 错误集合到本文
. 一. 编译错误 1. "AndroidManifest.xml file not found" 错误 (1) 报错信息 报错信息 : -- Message Make : Inf ...
- ionic build Android错误记录未解决
1.try itcordova -v cordova create testing cd testing cordova plugin add cordova-plugin-sim cordova p ...
- Android错误
1. [2016-09-16 14:25:45 - X_Card] Found 2 versions of android-support-v4.jar in the dependency list, ...
- Android错误:W/ResourceType(2411): No package identifier when getting value for resource number 0x
报错信息: 07-04 11:14:43.064: W/ResourceType(2411): No package identifier when getting value for resourc ...
随机推荐
- Golang原生sql操作Mysql数据库增删改查
Golang要操作mysql数据库,首先需要在当期系统配置GOPATH,因为需要使用go get命令把驱动包下载到GOPATH下使用. 首先配置好你的GOPATH,执行以下命令,下载安装mysql驱动 ...
- 【题解】Luogu P2073 送花
原题传送门 这题需要用到Splay 我们用一棵splay维护金钱 考虑c<=1000000 我们珂以把每种价格现在对应的美丽值存在一个a数组中 这样讲有珂能不太清楚qaq,还是对着操作一个一个讲 ...
- mint-ui之Swipe使用
<template> <div> <div class="swipe-wrapper"> <mt-swipe :auto="10 ...
- STM32之独立看门狗(IWDG)与窗口看门狗(WWDG)总结
一.独立看门狗 STM32 的独立看门狗由内部专门的 40Khz 低速时钟驱动,即使主时钟发生故障,它也仍然有效. 看门狗的原理:单片机系统在外界的干扰下会出现程序跑飞的现象导致出现死循环,看门狗电路 ...
- 动态规划之97 Interleaving String
题目链接:https://leetcode-cn.com/problems/interleaving-string/description/ 参考链接:https://blog.csdn.net/u0 ...
- topcoder srm 681 div1
problem1 link 二分答案.然后判断.将所有的机器按照$a_{i}$排序,$a_{i}$相同的按照$b_{i}$排序.用一个优先队列维护这些机器.这样对于第$i$个部分,拿出队列开始的机器来 ...
- 第一次参加acm区域赛
什么,这周天就要去参加acm焦作赛,简直不敢相信.从大一暑假七月份中旬到今天十一月23日,加入acm将近四个多月的时间,如今到了检验自己的时候了.aaaaaaaaaa.乌拉,必胜.打印个模板,在跑个步 ...
- 内置函数之sorted,filter,map
# 4,用map来处理字符串列表,把列表中所有人都变成sb,比方alex_sb # name=['oldboy','alex','wusir'] # print(list(map(lambda i:i ...
- FJNU2018低程A 逃跑路线(Lucas + 中国剩余定理 + LGV定理)题解
题目描述 n个人在w*h的监狱里面想要逃跑,已知他们的同伙在坐标(bi,h)接应他们,他们现在被关在(ai,1)现在他们必须要到同伙那里才有逃出去的机会,这n个人又很蠢只会从(x,y)->(x+ ...
- R class of subset of matrix and data.frame
a = matrix( c(2, 4, 3, 1, 5, 7), # the data elements nrow=2, # number of rows ...