Android bug日志/错误收集

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013148839/article/details/78363296

bug 收集

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 就好了

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 字段里添加
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

org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom'. Received status code 405 from server: Method Not Allowed

删除.gradle 文件夹

8. Recycyle 滑动到最后一项

 Called removeDetachedView with a view which is not flagged as tmp detached.ViewHolder{277104a position=3 id=-1, oldPos=-1, pLpos:-1} android.support.v7.widget.RecyclerView{6e4abbb VFED..... ......ID 0,0-1080,768 #7f09025f app:id/rc_chat}, adapter:com.shangwenwan.sww.adapter.message.ChatAdapter@95248d8, layout:android.support.v7.widget.LinearLayoutManager@94b0431, context:com.shangwenwan.sww.activity.message.ChatActivity@5fff557

原因 使用

                mRcChat.scrollToPosition(mChatAdapter.getItemCount() - 1);

解决 替换成

                        mRcChat.smoothScrollToPosition(mChatAdapter.getItemCount() - 1);

9. Glide加载长图时 圆角无效

原因

                        getRoundRequestOptions().transform(new RoundedCorners(radius)).centerCrop()

解决

  /**
     * @param url
     * @param imageView
     * @param radius    圆角  单位 px
     */
    public static void withRound2PX(String url, ImageView imageView, int radius) {
        if (checkFinish(imageView)) {
            return;
        }
        GlideApp.with(imageView)
                .load(url)
                .apply(
                        getRoundRequestOptions().transforms(new CenterCrop(),new RoundedCorners(radius))
                )
                .into(imageView);
    }

transforms 是可以设置 顺序 顺序 顺序的
参考 https://blog.csdn.net/qq_19269585/article/details/80968147

猜你喜欢

转载自blog.csdn.net/u013148839/article/details/78363296