No signature of method: java.util.ArrayList.get() is applicable for argument types: () values: []
Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):
Getting this error when running Android build (in Android Studio) on the latest version of RN Codepush (8.0.0)
Script './node_modules/react-native-code-push/android/codepush.gradle' line: 6
* What went wrong:
A problem occurred evaluating script.
> No signature of method: java.util.ArrayList.get() is applicable for argument types: () values: []
Possible solutions: get(int), get(int), set(int, java.lang.Object), set(int, java.lang.Object), grep(), grep()
Works fine on V7, assume that either the docs need to be upgraded for v8 or there's a bug somewhere
+1 I'm also facing same issue.
+1 I'm also facing same issue.
please recheck the if you follow all the steps correctly or not
yes followed all the steps still facing same issue.
yes followed all the steps still facing same issue.
show your code or if you want help then will connect
Just got the same error. But I solved it by downgrading from 8.0.1 to 7.0.1 code push version. My react native version 0.64.4
Upgraded React Native to 0.71.4 and V8 of rn-code-push no longer causes this error in Android.
If you're on an earlier version of React Native, the solution is to use v7 of this plugin, e.g. yarn add react-native-code-push@7.
If you want to make it work with a 0.6x React Native use this patch.
We use the following versions:
react-native: 0.64.4
react-native-code-push: 8.0.1
If you use patch-package this is the patch:
react-native-code-push+8.0.1.patch
diff --git a/node_modules/react-native-code-push/android/codepush.gradle b/node_modules/react-native-code-push/android/codepush.gradle
index a0f9d27..09a0951 100644
--- a/node_modules/react-native-code-push/android/codepush.gradle
+++ b/node_modules/react-native-code-push/android/codepush.gradle
@@ -1,9 +1,15 @@
// Adapted from https://raw.githubusercontent.com/facebook/react-native/d16ff3bd8b92fa84a9007bf5ebedd8153e4c089d/react.gradle
+/**
+ * A patch was applied to this file to fix an issue with the CodePush plugin
+ * Issue: https://github.com/microsoft/react-native-code-push/issues/2470#issuecomment-1519511406
+ * Patch: https://github.com/microsoft/react-native-code-push/pull/2471
+ */
+
import java.nio.file.Paths;
-def config = project.extensions.findByName("react") ?: []
-def bundleAssetName = config.bundleAssetName.get() ?: "index.android.bundle"
+def config = project.extensions.findByName("react") ?: [:]
+def bundleAssetName = config.bundleAssetName ? config.bundleAssetName.get() : "index.android.bundle"
// because elvis operator
def elvisFile(thing) {
@@ -24,7 +30,7 @@ android.buildTypes.each { buildType ->
}
gradle.projectsEvaluated {
- def debuggableVariants = config.debuggableVariants.get() ?: ['debug']
+ def debuggableVariants = config.debuggableVariants ? config.debuggableVariants.get() : ['debug']
android.applicationVariants.all { variant ->
// No code push for debuggable variants
@@ -49,8 +55,8 @@ gradle.projectsEvaluated {
def jsBundleFile;
// Additional node commandline arguments
- def nodeExecutableAndArgs = config.nodeExecutableAndArgs.get() ?: ["node"]
- def extraPackagerArgs = config.extraPackagerArgs.get() ?: []
+ def nodeExecutableAndArgs = config.nodeExecutableAndArgs ? config.nodeExecutableAndArgs.get(): ["node"]
+ def extraPackagerArgs = config.extraPackagerArgs ? config.extraPackagerArgs.get() : []
// Make this task run right after the bundle task
def generateBundledResourcesHash;
@@ -73,11 +79,11 @@ gradle.projectsEvaluated {
runBefore("merge${targetName}Assets", generateBundledResourcesHash)
} else {
def jsBundleDirConfigName = "jsBundleDir${targetName}"
- jsBundleDir = elvisFile(config."$jsBundleDirConfigName").get() ?:
+ jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ? elvisFile(config."$jsBundleDirConfigName").get():
file("$buildDir/intermediates/assets/${targetPath}")
def resourcesDirConfigName = "resourcesDir${targetName}"
- resourcesDir = elvisFile(config."${resourcesDirConfigName}").get() ?:
+ resourcesDir = elvisFile(config."${resourcesDirConfigName}") ? elvisFile(config."${resourcesDirConfigName}").get():
file("$buildDir/intermediates/res/merged/${targetPath}")
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
downgrade v7.0.4 working for me
Same issue with:
"react-native": "^0.72.0",
"react-native-code-push": "^8.0.2",
For anyone reading this, fyi react-native-code-push v8.0.0+ is incompatible with versions 0.65-0.70+ , took me a while to figure that out. Either you upgrade to RN 71 to use codepush v8 or you still with v7 for now.
Downgrading helped me but then faced this error : The CodePush module doesn't appear to be properly installed.
Iam Still facing the same issue downgraded the Codepush version to 7 still the same currently Iam using [email protected] `FAILURE: Build completed with 2 failures. So without codepush it works fine once I installed this I faced this issue
1: Task failed with an exception.
- Where:
- What went wrong: A problem occurred evaluating script.
No signature of method: java.util.ArrayList.get() is applicable for argument types: () values: [] Possible solutions: get(int), get(int), set(int, java.lang.Object), set(int, java.lang.Object), grep(), grep()
- 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. ==============================================================================
2: Task failed with an exception.
- What went wrong: A problem occurred configuring project ':app'.
compileSdkVersion is not specified. Please add it to build.gradle
- 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. ==============================================================================`