Reading time: < 1 minute
If you encounter the following error when generating the APK:
Could not find method compile() for arguments [com.facebook.react:react-native:X]
The first thing to do is to locate the error being produced. In this case, it indicates that the compile method is not found in the react-native-locale library.
This is indicated here:
[stderr] Build file '/home/expo/workingdir/build/node_modules/react-native-locale/android/build.gradle' line: 23
To solve this error, we need to open the file /node_modules/react-native-locale/android/build.gradle
And in line 23:
dependencies { copile 'com.facebook.react:react-native:0.17.+' }
Change compile to implementation as compile is deprecated in Android.
dependencies { implementation 'com.facebook.react:react-native:0.17.+' }
Another option is to try updating the library causing the problem to see if the issue is resolved in a newer version.