-
Notifications
You must be signed in to change notification settings - Fork 237
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 SDK 49 compatibility issue #808
Comments
Hey there - could be - I haven't tested notifee with rn72 / gradle 8 yet, but we do a little magic here to add our compiled AAR android library (which is in a local maven repository) to the set of maven repositories in the project. I think this is it https://github.com/invertase/notifee/blob/main/packages/react-native/android/build.gradle notifee/packages/react-native/android/build.gradle Lines 107 to 112 in 94cb4bc
Perhaps that's failing now... |
Just to let you know, Expo's SDK 49 has just been released from beta! PS: I'm not saying this to be pushy or anything, it's just to keep the context of this issue up to date. |
Facing the same issue as well after upgrading to Expo 49 Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available.
Searched in the following locations:
- file:/C:/Users/d11dev/GitHub/ProjectName/node_modules/react-native/android/app/notifee/core/maven-metadata.xml
- file:/C:/Users/d11dev/GitHub/ProjectName/node_modules/jsc-android/dist/app/notifee/core/maven-metadata.xml
- file:/C:/Users/d11dev/GitHub/ProjectName/apps/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml
- https://dl.google.com/dl/android/maven2/app/notifee/core/maven-metadata.xml
- https://repo.maven.apache.org/maven2/app/notifee/core/maven-metadata.xml
- https://www.jitpack.io/app/notifee/core/maven-metadata.xml
- https://oss.sonatype.org/content/repositories/snapshots/app/notifee/core/maven-metadata.xml
Required by:
project :app > project :notifee_react-native Additional context, this is a monorepo |
Following up on this, I was able to temporarily fix the issue with this config code (very rough): import {
ConfigPlugin,
withPlugins,
withProjectBuildGradle,
WarningAggregator,
} from "@expo/config-plugins";
import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
const MODULE_NAME = "rn-project-build-gradle";
const notifeeImport = `import java.nio.file.Paths`;
const notifeeFindNodeModulePath = `
def findNodeModulePath(baseDir, packageName) {
def basePath = baseDir.toPath().normalize()
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
if (candidatePath.toFile().exists()) {
return candidatePath.toString()
}
basePath = basePath.getParent()
}
return null
}
def notifeeDir = findNodeModulePath(projectDir, "@notifee/react-native") ?: "$rootDir/../node_modules/@notifee/react-native"`;
const notifeeCoreMavenUrl = `maven {
url "$notifeeDir/android/libs"
}
google()`;
const androidPlugin: ConfigPlugin<Map<string, string | boolean>> = (
config,
props,
) => {
return withProjectBuildGradle(
config,
async ({ modResults, ...subConfig }) => {
if (modResults.language !== "groovy") {
WarningAggregator.addWarningAndroid(
"withExpoProjectGradle",
`Cannot automatically configure project build.gradle if it's not groovy`,
);
return { modResults, ...subConfig };
}
// notifeeImport
modResults.contents = await applyGradleMod(
modResults.contents,
notifeeImport,
/buildscript(?:\s+)?\{/,
true,
0,
);
// notifeeFindNodeModulePath
modResults.contents = await applyGradleMod(
modResults.contents,
notifeeFindNodeModulePath,
/allprojects(?:\s+)?\{/,
true,
1,
);
// notifeeCoreMavenUrl
const regex =
/(?<=allprojects\s*{[\s\S]*repositories\s*{[\s\S]*?)google\(\)/g;
modResults.contents = modResults.contents.replace(
regex,
notifeeCoreMavenUrl,
);
return { modResults, ...subConfig };
},
);
};
const withExpoProjectGradle: ConfigPlugin<{} | void> = (config, _props) => {
const props = _props || {};
return withPlugins(config, [
[androidPlugin, new Map<string, string | boolean>(Object.entries(props))],
]);
};
const applyGradleMod = async (
buildGradle: string,
code: string,
anchorRegex: string | RegExp,
insertAbove: boolean = false,
tagNumber: Number = 0,
) => {
try {
return mergeContents({
// Tag needs to be unique so that previous mod does not get deleted
tag: `${MODULE_NAME}_${tagNumber}`,
src: buildGradle,
newSrc: code,
anchor: anchorRegex,
// new line will be inserted right above matched anchor when 0
offset: insertAbove ? 0 : 1,
comment: "//",
}).contents;
} catch (e) {
console.error(e);
return buildGradle;
}
};
export default withExpoProjectGradle; Seems like |
Wow, that's a hardcore plugin! |
I have the same issue trying to install the app on SDK 49. |
Have you tried using the plugin made by @d11dev? |
Yeah I'm on my way exploring on how to add config code like this. However an official solution would be preferred, you never know what other bugs may surface, especially in production code. For anyone curious how to add the config code, you can look at this documentation here |
Hello, would be also awesome if you could share the generated code inside "build" -directory, so would not need to setup module project to get generated code. As I would use the generated code inside my main apps plugin directory instead separate plugin. |
So I managed this, and here if some one is interested:
and file called "withExpoProjectGradle.js" with following content:
def notifeeDir = findNodeModulePath(projectDir, "@notifee/react-native") ?: "$rootDir/../node_modules/@notifee/react-native"
|
Or you can just use const config = {
expo: {
// ...
plugins: [
[
'expo-build-properties',
{
android: {
extraMavenRepos: ['$rootDir/../../../node_modules/@notifee/react-native/android/libs'],
}
},
],
],
},
}; Since my app is a monorepo configuration, the exact path may be different, but anyone can find the correct path by referring to the error message. |
This worked for me 👍 |
did not work for me on fresh install |
Try to run in verbose mode so it shows you the paths it is looking into for the maven repos. |
it did work, had the wrong path. android: {
extraMavenRepos: [
'../../node_modules/@notifee/react-native/android/libs',
],
}, that being said, build times have more than doubled 😕 expected? |
Works for me tks 💪 |
It happened to me as well since I updated my Expo SDK to 49. Is anyone have a good solution for this? Thanks in advance. |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
The issue is not stale, it's still relevant |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
This issue is still relevant. |
I'm afraid that the maintainers of this library no longer have the time to spend on it 😅 Maybe it's time to turn to Expo Notifications (even though I preferred the Notifee API). Note: this is of course not a criticism of the maintainers, who give a lot of their time to open source projects! |
@Thanaen not true: #899 (comment) |
Thanks @younes0 and no offense taken @Thanaen - I do have plans on getting this repo all polished up in the short-term and Invertase in the medium- long-term has and does benevolently provide resources to do so Still finishing up some urgent work in other repos to get things prepared for react-native 0.73 which is about to launch and requires some changes all over |
@shawarmaz the build times haven't changed on my side |
@younes0 This seemed to be the case when I wrote this comment 28 days ago. 😄 @mikehardy Glad to hear you'll be able to spend some time on the project in the short term! I was wondering, have you ever considered adding maintainers from outside Invertase to the project? I've recently seen some authors of open source projects turn to solutions like https://polar.sh/ to fund the resolution of issues that would be considered important, do you think that this, combined with the addition of external contributors, could help you keep the project active in the longer term? |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
I don't think this issue is stale, it seems to me that you still need to use the tricks mentioned here to make it work |
This worked for me, I had to remove $rootDir. Also note that you have to add the 'expo-build-properties' package to your project. I have a monorepo with the following structure:
|
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Still relevant |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
AFAIK it's still relevant |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
I'm still having this issue as well. I'm currently on Expo 51. I tried the For some reason, the docs on the website are outdated, they still mention adding |
Okay, I figured it out. The most important thing is to have the "plugins": [
[
"expo-build-properties",
{
"android": {
"compileSdkVersion": 34,
"targetSdkVersion": 34,
"extraMavenRepos": [
"$rootDir/../../../node_modules/@notifee/react-native/android/libs"
]
}
}
],
"@config-plugins/detox"
] I don't use a monorepo, so this path should work in most cases. I also needed to set versions to 34, because 33 won't compile due to some androidx dependencies. |
I am still getting this error, i did follow all the steps from expo upgrade helper and i did some modifications there, like delete some java files and added Kotlin instead, but i got the error that you mentioned up above, even when i added this code, didn't work,, is version 51 still with this error, and do you know any other alternatives to solve this? "plugins": [ |
@chicomoedas2 Did you run |
@effektsvk Hi there, I didn't, but how should looks my gradle.properties after this? Now, i have all the lines with # (commented) except for this lines org.gradle.jvmargs=-Xmx512m -XX:MaxMetaspaceSize=256m android.useAndroidX=true android.enableJetifier=true reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 newArchEnabled=false hermesEnabled=true expo.gif.enabled=true expo.webp.enabled=true expo.webp.animated=false EX_DEV_CLIENT_NETWORK_INSPECTOR=true expo.useLegacyPackaging=false And, is that corret i add the '$rootDir/../../../node_modules/@notifee/react-native/android/libs' path inside android: {} on my app.config.js? |
@chicomoedas2 It should have this line somewhere at the bottom: android.extraMavenRepos=[{"url":"$rootDir/../../../node_modules/@notifee/react-native/android/libs"}] But it should be added by the prebuild command, you (probably) should avoid making manual changes in the native projects and only use |
Okay, i'm gonna try again, executing the command |
Hello, thanks for your help folks, it did work, i just had to rebuild my android folder as you said. |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
this is still relevant |
Very relevant. None of these solutions are working for me |
Hello,
The first beta of the Expo 49 SDK has just been released, and I wanted to compile my application with it to see if it worked.
I've only tried it on Android for the moment, and I'm getting this error:
I'm thinking it might be linked to the switch to gradle 8.
Nothing urgent, since SDK 49 is only in beta, but I thought I'd give you a heads-up. :)
The text was updated successfully, but these errors were encountered: