Android 日誌錯誤收集
阿新 • • 發佈:2019-01-09
記錄錯誤 避免長時間忘記
1. Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7f674fb000 in tid -8665652 (
高併發下使用context 導致的 具體原因不明白 解決辦法 使用context的方法 加 synchronized ``` public synchronized static byte[] drawable2Byte(Context context, int tile_2) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.tile_2); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte data[] =baos.toByteArray(); bitmap.recycle(); try { if (baos != null) baos.close(); } catch (IOException e) { e.printStackTrace(); } return data; } ```
2. Android 錯誤無法debug 執行
Cannot debug application xx.xxx.xxx.app on device huawei-huawei_g7_tl00.
This application does not have the debuggable attribute enabled in its manifest.
If you have manually set it in the manifest, then remove it and let the IDE automatically assign it.
If you are using Gradle, make sure that your current variant is debuggable.
3. Instant Run requires ‘Tools | Android | Enable ADB integration’ to be enabled.
錯誤: Instant Run requires ‘Tools | Android | Enable ADB integration’ to be enabled.
4. Android studio 無法更新程式碼 AssertionError: null
android studio 在更新SVN 出現
AssertionError: null
在檔案目錄下 更新程式碼出現
Error: Please execute the ‘Cleanup’ command.
只要在 Cleanup 下 就可以更新了
5. Android 錯誤Error:Execution failed for task ‘:app:preDexDebug’.
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 1
原因
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}}
``` 這個問題有很多問題導致的 有可能重啟下studio 就好了
<div class="se-preview-section-delimiter"></div>
####6. Process 'command 'G:\android-sdk-windows\build-tools\20.0.0\aapt.exe'' finished with non-zero exit v
1. 暫時發現targetSdkVersion 要和supoport 相同 就是supoport 版本 不能高於 targetSdkVersion
2. 查詢是否有包衝突
3. 在build.gradle 中 android 欄位裡新增
<div class="se-preview-section-delimiter"></div>
dexOptions {
javaMaxHeapSize “4g”
preDexLibraries = false
}
“`
- did you try to to “Build”-> “Clean Project” and then go to “Build” -> “Rebuild Project”
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
- did you try to to “Build”-> “Clean Project” and then go to “Build” -> “Rebuild Project”
7.Android Studio升級3.1.2
刪除.gradle 資料夾