android-gpuimage-plus
android-gpuimage-plus copied to clipboard
你好,我在使用filter时发生java.lang.NoSuchMethodError ,请看看,谢谢
java.lang.NoSuchMethodError no static method "Lorg/wysaid/nativePort/CGENativeLibrary;.loadTextureByName(Ljava/lang/String;)Lorg/wysaid/nativePort/CGENativeLibrary$TextureResult;"
org.wysaid.nativePort 这个包下的代码不能混淆, 你自己使用的时候需要注意
主要是类名和函数名不能混淆, 比如你报错那个方法会在c++里面调用
可以了。谢谢
Sorry @wysaid, I don't speak Chinese so can't really understand what happen. The thing is I got hit with this error on my release build, debug build works all fine. I'm trying to investigate what's wrong. Is it because Proguard over doing thing again?
java.lang.NoSuchMethodError: no static method "Lorg/wysaid/nativePort/CGENativeLibrary;.loadTextureByName(Ljava/lang/String;)Lorg/wysaid/nativePort/CGENativeLibrary$TextureResult;"
at org.wysaid.nativePort.CGEImageHandler.nativeSetFilterWithConfig(CGEImageHandler.java)
at org.wysaid.nativePort.CGEImageHandler.setFilterWithConfig(CGEImageHandler.java:53)
at co.myapp.advanced_image_editor.image.effect.LUTFilter.setupFilterPanel(LUTFilter.java:113)
at co.myapp.advanced_image_editor.image.effect.AdjustmentManager.setupFilteredPanel(AdjustmentManager.java:172)
at co.myapp.advanced_image_editor.ImageEditorActivity.setupFilterAndAdjustment(ImageEditorActivity.java:559)
at co.myapp.advanced_image_editor.ImageEditorActivity.onCreate(ImageEditorActivity.java:236)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Basically I'm trying to set up a panel of thumbnails with LUT filter applied to them for preview. Again, this work just fine in debug build, only release build crashes.
public static final String ADJUST_LUT_PREFIX = "@adjust lut ";
protected void setupFilterPanel(final ViewGroup vg) {
SharedContext glContext = SharedContext.create();
glContext.makeCurrent();
CGEImageHandler handler = new CGEImageHandler();
handler.initWithBitmap(getThumbnail());
Bitmap filteredThumbnail = null;
for (int i = 0; i < vg.getChildCount(); ++i) {
final int index = i;
final String filterConfig = ADJUST_LUT_PREFIX + FilterLUTData.LUT_FILE_NAME_LIST[i];
handler.setFilterWithConfig(filterConfig);
//To accelerate this, you can add a Bitmap arg for "getResultBitmap",
// and reuse the Bitmap instead of recycle it every time.
filteredThumbnail = handler.getResultBitmap();
((ImageView) vg.getChildAt(i)).setImageBitmap(filteredThumbnail);
//select the first filter by default
if (i == 0) {
vg.getChildAt(i).setSelected(true);
}
//set click listener
vg.getChildAt(i).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//remove all view selected state
for (int x = 0; x < vg.getChildCount(); x++) {
(vg.getChildAt(x)).setSelected(false);
}
v.setSelected(true); //reselect the current clicked view
showFilteredImage(FilterLUTData.LUT_FILE_NAME_LIST[index]);
//Enable toast for testing
/*Toast toast = Toast.makeText(getApplicationContext(), ShuttaConstants.filterID[index], Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP|Gravity.CENTER_HORIZONTAL, 0, 0);
toast.show();*/
}
});
}
glContext.release();
handler.release();
handler = null;
}
........
public class FilterLUTData {
public static final String[] LUT_FILE_NAME_LIST = {
"filter_lut_original.png", "filter_lut_bw_10.png", "filter_lut_bw_17.png",
"filter_lut_bw_12.png", "filter_lut_bw_grayscale.png", "filter_lut_bw_16.png", "filter_lut_bw_19.png",
"filter_lut_16.png", "filter_lut_09.png", "filter_lut_47.png",
"filter_lut_44.png", "filter_lut_51.png", "filter_lut_45.png", "filter_lut_28.png", "filter_lut_06.png",
"filter_lut_33.png", "filter_lut_10.png", "filter_lut_34.png", "filter_lut_35.png", "filter_lut_49.png",
"filter_lut_40.png", "filter_lut_38.png", "filter_lut_46.png", "filter_lut_12.png", "filter_lut_24.png",
"filter_lut_43.png", "filter_lut_66.png", "filter_lut_39.png", "filter_lut_invert.png"
};
}
Yes, it's indeed a Proguard problem, add this to your proguard rules:
-keep class org.wysaid.nativePort.** { *; }