Open abhisekmallik opened 1 year ago
Hi @abhisekmallik!
I'm not a collaborator on this project. I just happened to be looking through issues for something unrelated to yours.
Lot of react native packages are having issues due to the architecture changes, including the upcoming move to AGP 8.0. As of AGP 7.3, which is shipped with react native 0.71+, android projects should start including a namespace
. As of AGP 8.0, it is required. Wouldn't you know it, there's no namespace in watermelondb.
I don't know if this will resolve your issue, but try adding
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
namespace "com.nozbe.watermelondb"
}
to this line https://github.com/Nozbe/WatermelonDB/blob/0974c47a559fa4f102f0026afb62d0ee368d01ca/native/android/build.gradle#L26
Also you may see a warning about the package name being declared in the android manifest (https://github.com/Nozbe/WatermelonDB/blob/0974c47a559fa4f102f0026afb62d0ee368d01ca/native/android/src/main/AndroidManifest.xml#L2), but you should be able to ignore it for now.
Props to https://github.com/react-native-community/discussions-and-proposals/issues/671#issuecomment-1598892444 for the potential fix!
I was able to get past this error by specifying the kotlin version in build.gradle
buildscript {
ext {
...
kotlinVersion = "1.8.22"
}
...
}
same problem with kotlinVersion 1.8.10, 1.8.22, 1.9.0
@xkelxmc you need to check the react native gradle's version to specific dedicated kotlinVersion
. Please refer here. To check your gradle version, go to android/gradle/wrapper/gradle-wrapper.properties
in the file you will see this line
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
Which mean the gradle version is 8.0.1. and use the correct kotlin version based on the link I mentioned. Hope this help!
I was able to get past this error by specifying the kotlin version in build.gradle
buildscript { ext { ... kotlinVersion = "1.8.22" } ... }
This solution worked for me. Thanks a lot daamsie.
As a side note (Honestly at first I was a little confused🤦♂️):
Add this lines to android/build.gradle
✅, not adding to android/app/build.gradle
❌
I have followed all the steps mentioned in the installation:
then ran yarn android
FAILURE: Build failed with an exception.