Closed jvgeee closed 1 year ago
I'm facing the same issue !
This error occurred on the react-native v0.70.4. Problem was here this line. apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
This error occurred on the react-native v0.70.4. Problem was here this line.
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
What do you mean @purevsurena? You missed the line? or changed something inside the file?
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
The line 5 in codepush.gradle should return a map, and is returning an ArrayList which doesn't support get() method
I just pushed a PR with the solution to this issue #2471
Facing same issue
I used v8 on a newly created project and it worked fine for both iOS and Android.
But for my old project. it only worked for iOS and gave this error for Android.
As @jvgeee said, I downgraded to v7 and it worked fine
@malikzype downgrade to v7 for a quick fix
I am facing same error
@vlack-coder Yes downgrading to v7 works fine
Same problem goes for me. I tried the patch mentionned above but I have an other error now :
FAILURE: Build failed with an exception.
* Where:
Script '/Users/cegedim/Documents/Cegedim/Code/Mobile/keynote2/packages/mobile-pro/node_modules/react-native-code-push/android/codepush.gradle' line: 6
* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method get() on null object
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
v8 only works with react-native 0.71. Nothing is mentioned in the docs.
i work on react native version 0.66, codepush version 8.0.0 and got this issue too.
Any update? Facing same on rn 0.68.0
Downgrading to 7..0.0 with RN 0.70.5 is working.
same here for React Native 0.64.2
Hello. I have solved this issue by doing the following: In this step, find the first line then insert the second line. The first line is already there. I copied and pasted 2 line at the end build.gradle file so first line is already there so it make file have 2 line have the same code so it cause error. In this step, delete include ':app' then copy paste this code to there. This step insert library then find ReactNativeHost then insert this code:
@Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); }
In this step, DeploymentKey can be get on web appcenter or use command appcenter codepush deployment list -a
so i have ownerName like nguyenquocan and app name like testApp i will have this command: appcenter codepush deployment list -a nguyenquuocan/testApp -k if you have @gmail.com at the end owner name -> appcenter codepush deployment list -a nguyenquocan-gmail.com/testApp -k
And you want to make update change you must change versionCode in android/app/build.gradle build.gradle will have this object -> android{defaultConfig{versionCode}} change like 1 -> 2. And change versionName don't make update in your app. It is the target you will update. if you have version 1.0.0 and version 1.0.1, it will not update version 1.0.0 to 1.0.1
if you want more details. You can read in this docs. https://learn.microsoft.com/en-us/appcenter/distribution/codepush/rn-get-started#android-setup
And 1 more thing. Version codepush support differnt sdk. So i have sdk version 30 codepush version 8.0.0 seem not support this. So i use version 7.0.4 then it work. Detail of my sdk i use:
That's all. I hope this will be useful.
same with RN 0.70.5
I'm find resolve here: #2471 https://github.com/microsoft/react-native-code-push/pull/2471/commits/dbbc0df43351ebee9eff7a7ae05bb3443a65304d
For anyone who is still facing the issue. follow these steps with library "react-native-code-push": "^7.0.1" , "react-native": "0.70.5" Codepush - appcenter - OTA - Autoupdate Install library - react-native-code-push
Install appcenter CLI - npm install -g appcenter-cli
Login to app center - appcenter login
Create a new app - appcenter apps create -d <AppName> -o <OS> -p React-Native
PS: Replace app name and os to your requirements.
Create Production and Staging keys using -
appcenter codepush deployment add -a <ownerName>/<appName> Production
appcenter codepush deployment add -a <ownerName>/<appName> Staging
PS: Replace ownerName and appName to your ownerName and appName
Once the app is set up, verify it with the appcenter.
Changes in React Native codebase. //Add this code to MainApplication.java
import com.microsoft.codepush.react.CodePush; //import this library
@Override //Add this code to the ReactNativeHost function.
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
<string moduleConfig="true" name="CodePushDeploymentKey">ProductionKey</string>
PS: Replace the production key to you production/staging keys obtained in step 5
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
PS: Dont enter the above code in the If block.
PS: this code creates a codepush wrapper class and we wrap the App component in this class
import codePush from "react-native-code-push";
const codePushOptions = {
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.IMMEDIATE,
};
export default App = codePush(codePushOptions)(App);
Once all of the above steps are completed, run the following command to create the deployment.
appcenter codepush deployment create -a <app_name> -d <deployment_name>
And run the following command to update your deployment.
appcenter codepush release-react -a <app_name> -d <deployment_name>
PS: Replace the app_name and deployment_name to your app’s name and Staging/Production respectively.
Note: Codepush might have some issues with some versions of ReactNative So make sure you have “react-native-code-push” → “7.0.1” if using “react-native" → “^0.70.0” References → Auto Update``
i solved this solved issue
"react-native": "0.68.2", "react-native-code-push": "8.0.1",
I didn't import the import com.microsoft.codepush.react.CodePush; in MainApplication.java
Note! You might have the following error.
Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists. Please double-check whether you have a duplicate code in root/android/app/build.gradle .
I solved this guys. I just downgrade codepush version from 8.0.1 to 7.0.4 There is an issue that needs to be fixed by codepush team
+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:
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 RN@0.70.0 `FAILURE: Build completed with 2 failures. So without codepush it works fine once I installed this I faced this issue
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.
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. ==============================================================================`
use patch package and change file codepush.gradle
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)
Works fine on V7, assume that either the docs need to be upgraded for v8 or there's a bug somewhere