compileSdkVersion is not specified. Please add it to build.gradle Affected Modules: notifee_react-native #145
Comments
@zaweiswise I added formatting to your post so it's easier to read - you may use triple back-ticks ('```') to enclose large code blocks in markdown and especially if you add a language specifier you get great, syntax highlighted results even To your problem: defaultConfig {
applicationId "com.appName"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2
versionName "2.0"
multiDexEnabled true
} This is a block from Please let us know how it goes |
I am also having the same issue when Sync Project with Gradle file it says
and when i build project it gives this error
Please resolve this issue as soon as possible i have already added rootProject.ext.compileSdkVersion in android/build.gradle and my default config look likes
i have also tried downgrading the library but got no success |
Okay, you have added that in the defaultConfig block but @burhanDebug you are jumping on someone else's issue and I don't know what you have in the top-level build.config ext block. So I don't know if they relate. I can tell you that I use notifee in my work project and it is compiling successfully, so this is not a "fix your module" problem. This is a "you have not integrated the module successfully and we are troubleshooting your project-specific problem" problem. Please shift to that perspective and maintain the idea that you need to examine your build.gradle files very carefully, as the solution will be changes to them, not to the module. |
@mikehardy my gradle files project level and app level are exactly same But when i create a new React native blank project Notifee installed successfully and project runs without any issue Is there any conflicts with One Signal libray or firebase crashlytics ? |
There should not be an incompatibility I want to focus on this line:
That matches my experience - fresh projects (and my work project) build fine. We can't reproduce this, so I don't know what is going on. If you could publish a repository that reproduces this, we could investigate. When I do web searches it is a bunch of vague answers (in my opinion) that might help but all indicate something not-well-understood is happening. Without a reproduction we'll be lost here I'm afraid https://stackoverflow.com/questions/59357028/android-error-cause-compilesdkversion-is-not-specified |
@mikehardy I have implemented your solution but didn't get any success. I am getting same issue as @burhanDebug has pointed. I am really stuck at this point. Please try to troubleshoot this issue. Also check the similar issue that is already closed without any solution .Issue #124 |
@zaweiswise I do not believe #124 has bearing though I am watching that as well. |
@zaweiswise I am unable to make that project work, but I noticed several odd things about it - the settings.gradle contains all sorts of unnecessary things and MainApplication has unneeded imports as well, plus many of the dependencies are very out of date. Every person's project is special to them but as a maintainer it is extremely inefficient to go into projects like that and attempt to find out why the project is broken. What I did after seeing that was to make a quick script that takes every single one of your package.json dependencies and adds them all to a demonstrator project. It compiles fine. In a clean project with all your dependencies, I cannot reproduce #!/bin/bash
set -e
# Basic template create, rnfb install, link
\rm -fr notifeedemo
echo "Testing react-native current + @notifee/react-native current"
npx react-native init notifeedemo --version="0.62.2"
cd notifeedemo
# # I have problems in my country with the cocoapods CDN sometimes, use github directly
# sed -i -e $'s/def add_flipper_pods/source \'https:\/\/github.com\/CocoaPods\/Specs.git\'\\\n\\\ndef add_flipper_pods/' ios/Podfile
# rm -f ios/Podfile.??
# Add notifee package
echo "Installing Notifee package"
yarn add @notifee/react-native
# Installing a pile of other packages to test compilation
yarn add \
@react-native-community/async-storage \
@react-native-community/datetimepicker \
@react-native-community/geolocation \
@react-native-community/masked-view \
@react-native-community/netinfo \
@react-native-firebase/app \
@react-native-firebase/crashlytics \
emoji-utils \
es6-symbol \
i18n-js \
libphonenumber-js \
lodash \
moment \
native-base \
prop-types \
react-native-animatable \
react-native-background-timer \
react-native-calendars \
react-native-color-picker \
react-native-contacts \
react-native-country-picker-modal \
react-native-dialogbox \
react-native-document-picker \
react-native-draggable-flatlist \
react-native-exit-app \
react-native-fast-image \
react-native-geolocation-service \
react-native-gesture-handler \
react-native-google-places-autocomplete \
react-native-image-crop-picker \
react-native-image-picker \
react-native-linear-gradient \
react-native-localize \
react-native-maps \
react-native-modal-datetime-picker \
react-native-modalize \
react-native-modals \
react-native-onesignal \
react-native-orientation \
react-native-paper \
react-native-raw-bottom-sheet \
react-native-reanimated \
react-native-responsive-fontsize \
react-native-restart \
react-native-safe-area-context \
react-native-screens \
react-native-swift \
react-native-swipeout \
react-native-thumbnail-video \
react-native-touch-id \
react-native-track-player \
react-native-vector-icons \
react-native-webview \
react-native-youtube \
react-navigation \
react-navigation-props-mapper \
react-navigation-stack \
react-navigation-tabs \
react-navigation-transitions \
react-redux \
recyclerlistview \
redux \
redux-persist \
redux-saga \
rn-fetch-blob \
underscore
# Copy in our demonstrator App.js
# echo "Copying demonstrator App.js"
# rm ./App.js && cp ../App.js ./App.js
# Set the Java application up for multidex (needed for API<21 w/Firebase)
echo "Configuring Android MultiDex for API<21 support - gradle toggle, library dependency, Application object inheritance"
sed -i -e $'s/defaultConfig {/defaultConfig {\\\n multiDexEnabled true/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/dependencies {/dependencies {\\\n implementation "androidx.multidex:multidex:2.0.1"/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/import android.app.Application;/import androidx.multidex.MultiDexApplication;/' android/app/src/main/java/com/notifeedemo/MainApplication.java
rm -f android/app/src/main/java/com/notifeedemo/MainApplication.java??
sed -i -e $'s/extends Application/extends MultiDexApplication/' android/app/src/main/java/com/notifeedemo/MainApplication.java
rm -f android/app/src/main/java/com/notifeedemo/MainApplication.java??
# Another Java build tweak - or gradle runs out of memory during the build
echo "Increasing memory available to gradle for android java build"
echo "org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" >> android/gradle.properties
# In case we have any patches
# echo "Running any patches necessary to compile successfully"
# cp -rv ../patches .
# npx patch-package
# Run the thing for iOS
if [ "$(uname)" == "Darwin" ]; then
echo "Installing pods and running iOS app"
cd ios && pod install --repo-update && cd ..
npx react-native run-ios
# workaround for poorly setup Android SDK environments
USER=`whoami`
echo "sdk.dir=/Users/$USER/Library/Android/sdk" > android/local.properties
fi
echo "Configuring Android release build for ABI splits and code shrinking"
sed -i -e $'s/def enableSeparateBuildPerCPUArchitecture = false/def enableSeparateBuildPerCPUArchitecture = true/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/def enableProguardInReleaseBuilds = false/def enableProguardInReleaseBuilds = true/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/universalApk false/universalApk true/' android/app/build.gradle
rm -f android/app/build.gradle??
# Run it for Android (assumes you have an android emulator running)
echo "Running android app"
npx react-native run-android --variant release
# Let it start up, then uninstall it (otherwise ABI-split-generated version codes will prevent debug from installing)
sleep 10
pushd android
./gradlew uninstallRelease
popd
# may or may not be commented out, depending on if have an emulator available
# I run it manually in testing when I have one, comment if you like
npx react-native run-android
|
@mikehardy I created a new project updated all my project dependencies and build it again still the issue was same. |
We will are doing everything according to Android docs, the troubleshooting difficulties were because we have nothing to do. It's my understanding from the other issue that one signal has work to do, and that is out of our control. We can document this though, it's very helpful to know that an incompatibility in a popular library exists and now we have a workaround - a lot of value in that |
OneSignal integration docs changed here - working on getting them out to the live site now, thanks for helping figure this out! notifee/documentation@7249b1d |
@N0v1a - not enough for anyone to help - https://stackoverflow.com/help/minimal-reproducible-example |
apply plugin: 'com.android.application'
} allprojects {
} //task clean(type: Delete) { |
↓my build.gradle(:app) |
plugins { android {
} dependencies {
} |
Start with this: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh |
This happens to me when I upgrade the Gradle version. |
I want to implement notifee in my react native app.
I have paste Package.json , build.gradle (both) and Metro bundler error. I have tried updating my android sdk but still get this error . It is preventing me to build my app
System info:
Package.json
build.gradle (project)
Metro-bundler error
The text was updated successfully, but these errors were encountered: