Closed zaweiswise closed 4 years ago
@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 android/build.gradle
, you should add compileSdkVersion rootProject.ext.compileSdkVersion
there and it should work?
Please let us know how it goes
I am also having the same issue when Sync Project with Gradle file it says
compileSdkVersion is not specified. Please add it to build.gradle
Affected Modules: notifee_react-native
and when i build project it gives this error
android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:15: error: package io.invertase.notifee does not exist
import io.invertase.notifee.NotifeePackage;
^
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
defaultConfig {
applicationId "com.appName"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
versionCode 2
versionName "2.0"
multiDexEnabled true
}
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 My package.json file is also almost same having same react native version i am also successfully using One Signal Library and firebase crashlytics with the same version posted by @zaweiswise Could you please look into it now
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:
But when i create a new React native blank project Notifee installed successfully and project runs without any issue
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
Here is the repository link from where you can reproduce the same error.
https://github.com/zaweiswise/notifee-bug.git
@zaweiswise I do not believe #124 has bearing though I am watching that as well. Thanks for attempting a reproduction - I see your invite to that repo and I'll clone it and investigate
@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. Now:
OneSignal
or vice versa.so as @ashokkumar88 suggested : 'Onesignal gradle plugin mentioned in their documentation. After removing this plugin the build was successful.' This solved the error. I also configured my previous project it also worked without any issue. So the issue was not with the outdated libraries. It was Onesignal conflict with notifee. I hope you will fix that issue and make an alternate solution for that.
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! https://github.com/notifee/documentation/commit/7249b1d497b7dac9765677642aae970c09cb93b7
Can anyone please help me...
And this too
@N0v1a - not enough for anyone to help - https://stackoverflow.com/help/minimal-reproducible-example
This is the error
apply plugin: 'com.android.application' apply plugin: 'com.chaquo.python' buildscript { ext.kotlin_version = "1.5.21" repositories { google() mavenCentral() maven { url "https://chaquo.com/maven" } //noinspection JcenterRepositoryObsolete } dependencies { //noinspection AndroidGradlePluginVersion classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.chaquo.python:gradle:9.1.0"
}
}
allprojects { repositories { google() mavenCentral() //noinspection JcenterRepositoryObsolete jcenter()
}
}
//task clean(type: Delete) { // delete rootProject.buildDir //}
↓my build.gradle(:app)
plugins { id 'com.android.application' id 'kotlin-android' }
android { compileSdkVersion 30 buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.nova.chmlimp"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "x86"
}
python {
buildPython "C:/Users/Sayan/AppData/Local/Programs/Python/Python37-32/python.exe"
}
sourceSets {
main {
python.srcDir ["src/main/python"]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Start with this: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh It works Add what you need to until it breaks, post that as a repo
This happens to me when I upgrade the Gradle version. what I did is I uninstall the library and clean, then install it again, and boom its works as sharp.
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