Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expo 49 migration #80

Open
rafakwolf opened this issue Jul 10, 2023 · 9 comments
Open

expo 49 migration #80

rafakwolf opened this issue Jul 10, 2023 · 9 comments
Assignees

Comments

@rafakwolf
Copy link

Hi folks, I'm migrating from expo 48 to 49 ... and the gradle version is being migrated to version 8.
And react-native-adapty is throwing an error:

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find io.adapty.internal:crossplatform:2.4.2.
     Searched in the following locations:
       - file:/Users/rafael/dev/preco-teto-acoes/node_modules/react-native/android/io/adapty/internal/crossplatform/2.4.2/crossplatform-2.4.2.pom
       - file:/Users/rafael/dev/preco-teto-acoes/node_modules/jsc-android/dist/io/adapty/internal/crossplatform/2.4.2/crossplatform-2.4.2.pom
       - https://dl.google.com/dl/android/maven2/io/adapty/internal/crossplatform/2.4.2/crossplatform-2.4.2.pom
       - https://repo.maven.apache.org/maven2/io/adapty/internal/crossplatform/2.4.2/crossplatform-2.4.2.pom
       - https://www.jitpack.io/io/adapty/internal/crossplatform/2.4.2/crossplatform-2.4.2.pom
       - https://oss.sonatype.org/content/repositories/snapshots/io/adapty/internal/crossplatform/2.4.2/crossplatform-2.4.2.pom
     Required by:
         project :app > project :react-native-adapty

Can I have some help?

Thank you!

Originally posted by @rafakwolf in #79

@divanc
Copy link
Collaborator

divanc commented Jul 11, 2023

Hey! Having a look...

@divanc divanc self-assigned this Jul 11, 2023
@jasonpeinko
Copy link

Same issue with a bare react-native project (no expo) using RN 0.72.3

* What went wrong:                                                                                                                                                                                                                                                                                        
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.                                                                                                                                                                                                                            
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.                                                                                                                                                                                                                 
   > Could not find io.adapty.internal:crossplatform:2.4.2.                                                                                                                                                                                                                                               
     Required by:                                                                                                                                                                                                                                                                                         
         project :app > project :react-native-adapty     

There was a suggestion in similar issue to manually include the maven repo via the following. Note path was adjusted for monorepo.

        maven {
            url "$rootDir/../../../node_modules/react-native-adapty/lib/android/localMaven"
        }

This made no difference.

@jasonpeinko
Copy link

Was able to get a build working by setting the local repository under allProjects rather than buildScript.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
        maven {
            url "$rootDir/../../../../node_modules/react-native-adapty/lib/android/localMaven" // <---- This didn't work
        }
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
    }

    allprojects {
        project.pluginManager.withPlugin("com.facebook.react") {
            react {
                reactNativeDir = rootProject.file("../../../node_modules/react-native/")
                codegenDir = rootProject.file("../../../node_modules/@react-native/codegen/")
            }
        }
    }

}

allprojects {
    repositories {
        maven {
            url "$rootDir/../../../node_modules/react-native-adapty/lib/android/localMaven" // <----- This worked
        }
    }
    project.pluginManager.withPlugin("com.facebook.react") {
        react {
            reactNativeDir = rootProject.file("../../../node_modules/react-native/")
            codegenDir = rootProject.file("../../../node_modules/@react-native/codegen/")
        }
    }
}

@rafakwolf
Copy link
Author

@divanc Hello, anything new about this?
Thank you!

@megacherry
Copy link

megacherry commented Aug 19, 2023

I was able to solve it via app.json. Add under plugins expo-build-properties:

[
  "expo-build-properties",
  {
    "android": {
      "extraMavenRepos": [
        "../../node_modules/react-native-adapty/lib/android/localMaven"
      ]
    },
  }
],

If you are in a monorepo, then use "$rootDir/../../../node_modules/react-native-adapty/lib/android/localMaven" instead of the other path. :)

@leons1767
Copy link

I was able to solve it via app.json. Add under plugins expo-build-properties:

[
  "expo-build-properties",
  {
    "android": {
      "extraMavenRepos": [
        "../../node_modules/react-native-adapty/lib/android/localMaven"
      ]
    },
  }
],

If you are in a monorepo, then use "$rootDir/../../../node_modules/react-native-adapty/lib/android/localMaven" instead of the other path. :)

I encountered the same problem with expo run: android --device , building using eas was fine. Thanks @megacherry for this workaround, it works for me.

I encountered another problem after this. Expo somehow screws up the namespace in the build.gradle file, so the local development build will fail. The problem exists in both SDK48 and SDK49. The solution is to correct the namespace manually. I mention this here because I figure many are upgrading their Expo SDK because Google is enforcing targeted API Level 33 in a few days.

Detail and credit

@rafakwolf
Copy link
Author

Thank you @megacherry and @jasonpeinko

@divanc
Copy link
Collaborator

divanc commented Aug 29, 2023

Ouch, sorry guys, missed that...
I'll read whether we can avoid extra step.

Strange that Expo is able to find one lib and fails to find another

@erenkulaksiz
Copy link

I was able to solve it via app.json. Add under plugins expo-build-properties:

[
  "expo-build-properties",
  {
    "android": {
      "extraMavenRepos": [
        "../../node_modules/react-native-adapty/lib/android/localMaven"
      ]
    },
  }
],

If you are in a monorepo, then use "$rootDir/../../../node_modules/react-native-adapty/lib/android/localMaven" instead of the other path. :)

This solved my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants