Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ on generate APK

Tags:

gradle

gson

My project is run on AVD properly. but when i try to generate signed APK, gradle get this error:

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
> Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more 
log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

I've used this command many times: gson.fromJson. but i can't find error source. (which file and which line).

So how do I find the source of the error

like image 795
Iman Marashi Avatar asked Mar 02 '20 09:03

Iman Marashi


1 Answers

I got this error in Android Studio 4.0 when I did a Gradle sync after switching branches. I fixed it by doing this:

  1. Build -> Clean Project
  2. Sync Project with Gradle files
like image 200
Sam Avatar answered Oct 25 '22 03:10

Sam