记录开发中出现的错误信息
1.
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
2.
Android:在设置Button上面的内容(含字母时)字母被强制转换成了大写.
解决办法:在xml中加上
android:textAllCaps=”false”,使其不会自动转换为大写
3.
adb install GiftCard-Android-debug.apk
Failure [INSTALL_FAILED_OLDER_SDK]
这是因为: App minSdkVersion > 手机的版本
4. java.lang.NumberFormatException: Invalid int: “10000000581”
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parse(Integer.java:378)
at java.lang.Integer.parseInt(Integer.java:366)
at java.lang.Integer.parseInt(Integer.java:332)
10000000581大于了int 的最大值了,所以出现了这个异常
5.System.err W java.lang.IllegalStateException: Cannot add header view to list – setAdapter has already been called.
6.编译器 (1.8.0_66) 中出现异常错误。如果在 Java Bug Database (http://bugreport.java.com/bugreport/) 中没有找到该错误, 请在该数据库中建立 Bug。请在报告中附上您的程序和以下诊断信息。谢谢。
com.sun.tools.javac.code.Symbol$CompletionFailure: 找不到java.lang.invoke.MethodType的类文件
7.
System.err W android.content.res.Resources$NotFoundException: String resource ID #0x0
给一个TextView设置了一个int值
8.
Error:Execution failed for task ‘:app:buildInfoDebugLoader’.
Exception while doing past iteration backup :
Source /home/malin/malin_demo/MyView/app/build/intermediates/builds/debug/21939500510103/classes.dex
and destination /home/malin/malin_demo/MyView/app/build/intermediates/builds/debug/21939500510103/classes.dex
must be different
处理办法:clean一下项目就好。
9.“Couldn’t resolve resource” in Android Studio’s Preview
Couldn’t resolve resource @string/app_name
It’s possible that the layout preview started drawing before all the files were processed. Android Studio and Eclipse both frequently suffer from tool synchronization problems.
In the many cases, simply refreshing the layout preview will solve the problem (of course I’m assuming that you do have the string app_name defined). The arrow marks the refresh button.
http://stackoverflow.com/questions/24485012/android-rendering-problems-couldnt-resolve-resource-string-app-name
https://stackoverflow.com/questions/19429948/couldnt-resolve-resource-in-android-studios-preview/19432652#19432652
10.控件的点击事件没有触发
调查发现是因为:给控件设置了两次监听事件。
第二次覆盖了第一次的事件。导致第一次的无法响应
<activity
android:name=".mvp.MActivity"
android:screenOrientation="portrait"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
intent-filter>
activity>
这里出现了两个不同的category.
12.
Activity com.malin.anr.MainActivity has leaked IntentReceiver com.malin.anr.MainActivity 1@52850e30thatwasoriginallyregisteredhere.AreyoumissingacalltounregisterReceiver()?android.app.IntentReceiverLeaked:Activitycom.malin.anr.MainActivityhasleakedIntentReceivercom.malin.anr.MainActivity 1@52850e30 that was originally registered here. Are you missing a call to unregisterReceiver()?
原因:注册广播后,没有解除
13.
Testing
运行错误:
Process com.malin.animation died,PID:10144.(com.malin.animation/.mvp.MActivity,app-request)[NOT_ENOUGH_RAM:true, LOW_MEMORY:false, TESTIN_AGENT_DIED:false] Memory usage[Total:481280KB, Avalable:50632KB, com.malin.animation(10144) used:20421KB] Died reason : Device have not enough ram,Please optimize APP memory usage.
14
javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: current time: Mon Dec 16 12:14:36 格林尼治标准时间+0800
javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: current time: Mon Dec 16 12:14:36 格林尼治标准时间+0800 2013, validation time: Thu Jun 16 08:00:00 格林尼治标准时间+0800 2016
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:375)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:241)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:198)
at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:174)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at com.malin.animation.network.c.g.intercept(LoginService.java:144)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at com.malin.animation.network.c.h.intercept(LoginService.java:128)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
at okhttp3.RealCall.execute(RealCall.java:60)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory RequestArbiter.request(RxJavaCallAdapterFactory.java:171)atb.d.a.ax.request(OperatorSubscribeOn.java:80)atb.v.setProducer(Subscriber.java:211)atb.d.a.s.setProducer(OperatorMap.java:99)atb.d.a.s.setProducer(OperatorMap.java:99)atb.v.setProducer(Subscriber.java:205)atb.d.a.aw.setProducer(OperatorSubscribeOn.java:76)atb.v.setProducer(Subscriber.java:205)atretrofit2.adapter.rxjava.RxJavaCallAdapterFactory CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)atb.d.a.h.a(OnSubscribeLift.java:50)atb.d.a.h.call(OnSubscribeLift.java:30)atb.j.a(Observable.java:8666)atb.d.a.av.call(OperatorSubscribeOn.java:94)atb.d.c.f.call(CachedThreadScheduler.java:220)atb.d.c.t.run(ScheduledAction.java:55)atjava.util.concurrent.Executors RunnableAdapter.call(Executors.java:442)
at java.util.concurrent.FutureTask Sync.innerRun(FutureTask.java:305)atjava.util.concurrent.FutureTask.run(FutureTask.java:137)atjava.util.concurrent.ScheduledThreadPoolExecutor ScheduledFutureTask.access 201(ScheduledThreadPoolExecutor.java:150)atjava.util.concurrent.ScheduledThreadPoolExecutor ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:838)
15.
Caused by: java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 18 declared in library [WeiboSDKDemo:weiboSDK:unspecified] /home/malin/malin_demo/WeiboSDKDemo/weiboSDKDemo/build/intermediates/exploded-aar/WeiboSDKDemo/weiboSDK/unspecified/AndroidManifest.xml
Suggestion: use tools:overrideLibrary=”com.sina.weibo.sdk” to force usage
http://stackoverflow.com/questions/27095077/how-do-i-use-toolsoverridelibrary-in-a-build-gradle-file
16.
libpng error: Not a PNG file
http://stackoverflow.com/questions/33846901/libpng-error-not-a-png-file
http://stackoverflow.com/questions/23366222/libpng-error-not-a-png-file-error-showing-in-android-studio
http://stackoverflow.com/questions/23366222/libpng-error-not-a-png-file-error-showing-in-android-studio
18.魅族手机不现实Toast
原因是,在设置中将该应用的提示给去掉了
19.有些手机不现实动画。
原因可能是在开发者选项中将
窗口动画缩放 设置为关闭、
过度动画缩放 设置为关闭
动画程序时长缩放 设置为关闭