flutter_image_cropper icon indicating copy to clipboard operation
flutter_image_cropper copied to clipboard

App crashes in release mode with integration_test dependency

Open vytautas-pranskunas- opened this issue 3 years ago • 6 comments

Hello,

When I am trying to add integration tests to my project i noticed that app starts to crash. I thought it is because image picker but it is not. Image picker alone works fine. But image cropper crashes with:

FATAL EXCEPTION: main
E/AndroidRuntime(21295): Process: com.senio.assist, PID: 21295
E/AndroidRuntime(21295): java.lang.NoSuchMethodError: No static method asAttributeSet(Lo/c/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'android.util.Xml' appears in /system/framework/framework.jar!classes2.dex)
E/AndroidRuntime(21295): 	at d.a.n.g.inflate(Unknown Source:21)
E/AndroidRuntime(21295): 	at com.sangcomz.fishbun.ui.picker.PickerActivity.onCreateOptionsMenu(Unknown Source:6)
E/AndroidRuntime(21295): 	at android.app.Activity.onCreatePanelMenu(Activity.java:3616)
E/AndroidRuntime(21295): 	at androidx.fragment.app.e.onCreatePanelMenu(Unknown Source:2)
E/AndroidRuntime(21295): 	at d.a.n.i.onCreatePanelMenu(Unknown Source:2)
E/AndroidRuntime(21295): 	at androidx.appcompat.app.g$o.onCreatePanelMenu(Unknown Source:8)
E/AndroidRuntime(21295): 	at d.a.n.i.onCreatePanelMenu(Unknown Source:2)
E/AndroidRuntime(21295): 	at androidx.appcompat.app.l.n(Unknown Source:25)
E/AndroidRuntime(21295): 	at androidx.appcompat.app.l$a.run(Unknown Source:2)
E/AndroidRuntime(21295): 	at android.os.Handler.handleCallback(Handler.java:809)
E/AndroidRuntime(21295): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(21295): 	at android.os.Looper.loop(Looper.java:166)
E/AndroidRuntime(21295): 	at android.app.ActivityThread.main(ActivityThread.java:7383)
E/AndroidRuntime(21295): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21295): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
E/AndroidRuntime(21295): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)

I have described this issue previously here thinking that it was image picker fault. https://github.com/flutter/flutter/issues/85247

Without fix of this I am not able to release app with integration_test dependency even when it is dev_dependency

vytautas-pranskunas- avatar Aug 11 '21 08:08 vytautas-pranskunas-

After a small research on previous issues that mentions No static method asAttributeSet, I found this comment that might can explain why we are getting this error.

alexrintt avatar Aug 12 '21 02:08 alexrintt

But it does not explain how to fix it... :(

vytautas-pranskunas- avatar Aug 12 '21 09:08 vytautas-pranskunas-

Creating the release apk/app bundle in VS code resulted in this error (It was working fine previously. After adding integration_test, the issue started to reproduce).

Somehow creating the app bundle through Android studio worked.

Open the android folder of your flutter project in Android studio. Let the gradle update it's dependencies and wait for the indexing to be completed. Clean the project. Then generate the signed Bundle or APK.

Deepak-GP avatar Sep 17 '21 07:09 Deepak-GP

Creating the release apk/app bundle in VS code resulted in this error (It was working fine previously. After adding integration_test, the issue started to reproduce).

Somehow creating the app bundle through Android studio worked.

Open the android folder of your flutter project in Android studio. Let the gradle update it's dependencies and wait for the indexing to be completed. Clean the project. Then generate the signed Bundle or APK.

Please describe in detail how to fix it

ConnorPhan avatar Oct 08 '21 07:10 ConnorPhan

@ConnorPhan

Open the android folder of your flutter project in Android studio. Let the gradle update it's dependencies and wait for the indexing to be completed. Clean the project. (Build -> Clean Project) Then generate the signed Bundle or APK. (Build -> Generate Signed Bundle/APK)

Deepak-GP avatar Nov 09 '21 06:11 Deepak-GP

This fix worked for me https://stackoverflow.com/a/60631550/9581817

VladShturma avatar Feb 07 '22 10:02 VladShturma