Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit 009ae1e

Browse files
committed
[BUGFIX]:{The producer output buffer format 0x1 doesn't match the ImageReader's configured buffer format 0x4.}
1 parent af26493 commit 009ae1e

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ android {
1616
minifyEnabled false
1717
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1818
}
19+
debug{
20+
minifyEnabled false
21+
}
1922
}
2023
}
2124

app/src/main/java/com/androidyuan/androidscreenshot_sysapi/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import android.support.v7.app.AppCompatActivity;
55
import android.os.Bundle;
66
import android.view.View;
7-
87
import com.androidyuan.lib.screenshot.ScreenShotActivity;
98

9+
1010
public class MainActivity extends AppCompatActivity {
1111

1212
@Override

libshot/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ android {
1212
}
1313
buildTypes {
1414
release {
15-
minifyEnabled true
15+
minifyEnabled false
1616
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1717
}
1818
}

libshot/src/main/java/com/androidyuan/lib/screenshot/Shotter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public Shotter(Context context, Intent data) {
5555
mImageReader = ImageReader.newInstance(
5656
getScreenWidth(),
5757
getScreenHeight(),
58-
PixelFormat.RGB_565,// a pixel两节省一些内存 个2个字节 此处RGB_565 必须和下面 buffer处理一致的格式
58+
PixelFormat.RGBA_8888,//此处必须和下面 buffer处理一致的格式 ,RGB_565在一些机器上出现兼容问题。
5959
1);
6060
}
6161
}
@@ -129,7 +129,7 @@ protected Bitmap doInBackground(Image... params) {
129129
int rowStride = planes[0].getRowStride();
130130
int rowPadding = rowStride - pixelStride * width;
131131
Bitmap bitmap = Bitmap.createBitmap(width + rowPadding / pixelStride, height,
132-
Bitmap.Config.RGB_565);
132+
Bitmap.Config.ARGB_8888);//虽然这个色彩比较费内存但是 兼容性更好
133133
bitmap.copyPixelsFromBuffer(buffer);
134134
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height);
135135
image.close();

0 commit comments

Comments
 (0)