expo / config-plugins

Out-of-tree Expo config plugins for packages that haven't adopted the config plugin system yet.
460 stars 98 forks source link

Error on Builidng with EAS on SDK 50 with react-native-branch. #249

Open NicolasRecomiendApp opened 1 month ago

NicolasRecomiendApp commented 1 month ago

Summary

Hello everyone. Let me explain our situation. I'm the main app developer of Recomiendapp and we've been experiencing some bugs related to building with EAS for the last few days. This is only happening on Android as marked. So we first tried to do a development build and it seemed to fail with an error:

FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/home/expo/workingdir/build/node_modules/expo-modules-core/android/ExpoModulesCorePlugin.gradle' line: 40
* What went wrong:
A problem occurred evaluating project ':config-plugins-react-native-branch'.
> Failed to apply plugin class 'KotlinExpoModulesCorePlugin'.
   > Could not find method android() for arguments [KotlinExpoModulesCorePlugin$_apply_closure4@256227d1] on project ':config-plugins-react-native-branch' of type org.gradle.api.Project.

Then we started to try to match the cause of the bug; we tried to change some library versions to match the last build that was running. The main versions changed were from: expo 50.0.21 to 50.0.8, @expo/config-plugins: from 8.x.x (don't remember exactly) to 7.8.4 and expo-dev-client from 3.3.12 to 3.3.9.

So having:

expo on 50.0.8, expo/config-plugins on 7.8.4 expo-dev-client on 3.3.9

After adjusting these versions, deleting node_modules and package-lock.json and reinstalling with npm install, we rebuilt on a development profile and it passed the error "A problem occurred evaluating project ':config-plugins-react-native-branch'".

After everything was fine with our Android integration, we tried to rebuild with a preview profile to test it as an APK. Now we didn't get a branch plugin error, but we did get this one: #30898

So we're using SDK 50 because Firebase is integrated into our project, and it's still not available to use on SDK 51 or ahead (canary 52 I guess).

Then we looked for the comment of @kitten (image):

image

And that's what we tried. We upgraded our expo to 50.0.20 and used npx expo install --fix. After that, we rebuilt, and suddenly we got the branch error again.

I've built a new project and forced both errors with these dependencies and both were reflexed with command: eas build --profile preview --platform android.

Conclusions, we are trapped; if we stay on 50.0.8, we get error #30898, and if we upgrade to fix it, we get a branch error. Could you please shed some light on our problem? Thanks in advance!

I'm here to help you with anything you need to help us solve the problem.

Config Plugin

@config-plugins/react-native-branch

What platform(s) does this occur on?

Android

SDK Version

50.0.20

Reproducible demo

  "dependencies": {
    "@config-plugins/react-native-branch": "^7.0.0",
    "@expo/config-plugins": "^7.8.0",
    "@expo/vector-icons": "^14.0.2",
    "@react-navigation/native": "^6.0.2",
    "expo": "~50.0.20",
    "expo-constants": "~15.4.6",
    "expo-dev-client": "~3.3.12",
    "expo-font": "~11.10.3",
    "expo-linking": "~6.2.2",
    "expo-router": "~3.4.10",
    "expo-splash-screen": "~0.26.5",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "~2.9.4",
    "expo-web-browser": "~12.8.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.73.6",
    "react-native-branch": "^6.0.0",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-reanimated": "~3.6.2",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "~3.29.0",
    "react-native-web": "~0.19.10"
  },
DishopGitAdmin commented 1 week ago

Hello Nicolas, did you find any solution to this problem?

NicolasRecomiendApp commented 1 week ago

Hi @DishopGitAdmin we are currently working to upgrade and check SDK 51 of Expo, then if everything is ok, we will come back to get some feedback and close the thread. Thanks for your answer.

NicolasRecomiendApp commented 1 week ago

Hi again, I'm having a problem with the Expo 51 SDK. I have successfully upgraded to 51 and successfully built a development profile (dev build). Everything seemed fine, but when I install and open the dev build, it immediately crashes and closes (not even showing the interface with the active servers). So I read the logs and could see many errors from branch. I decided to remove branch and rebuild it to see if that was the problem. And it was; after removing the branch code and configuration, it started as normal, and after reading the Expo dev QR, started the project, and could navigate through the entire application.

Those are the logs:

java.lang.RuntimeException: Unable to create application com.recomiend.MainApplication: android.content.res.Resources$NotFoundException: String resource ID #0x0 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7100) at android.app.ActivityThread.access$1600(ActivityThread.java:276) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2131) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8293) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045) Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0 at android.content.res.Resources.getText(Resources.java:463) at android.content.res.MiuiResources.getText(MiuiResources.java:106) at android.content.res.Resources.getString(Resources.java:556) at io.branch.referral.BranchUtil.readBranchKey(BranchUtil.java:113) at io.branch.referral.Branch.getAutoInstance(Branch.java:385) at io.branch.rnbranch.RNBranchModule.getAutoInstance(RNBranchModule.java:106) at expo.modules.adapters.branch.BranchApplicationLifecycleListener.onCreate(BranchApplicationLifecycleListener.kt:13) at expo.modules.ApplicationLifecycleDispatcher.onApplicationCreate(ApplicationLifecycleDispatcher.kt:20) at com.recomiend.MainApplication.onCreate(MainApplication.kt:48) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7094) And 9 more...

I tried just to reactivate the branch with the base config (adding to config-plugins with the live_key, and the info for ios infoplist, but as I'm building for android, is not necessary.) but still does not run.

My versions of branch are:

"@config-plugins/react-native-branch": "^8.0.0", "@expo/config-plugins": "^8.0.10", "react-native-branch": "^6.3.0",

Version of expo and rn:

"expo": "~51.0.37", "expo-dev-client": "~4.0.28", "react-native": "0.74.5",

Any Ideas?