How to slove this issue - Task :react-native-push-notification:compileDebugJavaWithJavac FAILED , import com.google.firebase.iid issue [closed] - firebase-cloud-messaging

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
![\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:40: error: cannot find symbol
import com.google.firebase.iid.InstanceIdResult

There is some issue at 7.2.* version.
Try moving to the latest version or any 7.3.* version.
npm i react-native-push-notification#latest

I faced this issue yesterday. And I fixed it by using the following steps.
First I uninstalled it.
npm uninstall react-native-push-notification
Then I installed it back in. (Maybe you can just update it to the latest version as well. I just didn't know the npm command line for that)
npm install react-native-push-notification
In android/app/build.gradle, add the following code in defaultConfig :
dexOptions {
javaMaxHeapSize "4g"
}
Also add:
implementation 'com.google.firebase:firebase-messaging:21.1.0'
In android/gradle.properties, add the following code:
firebaseMessagingVersion=21.1.0
Delete node_module. (Perhaps, you don't need to do this.)
Finally, run npm install. You might have to run yarn install and rebuild your project again with Android Studio as well.
You probably don't need to follow every step in here. But these are what I did yesterday. I hope this helps.

Follow the steps.
npm i react-native-push-notification#latest
android/build.gradle
buildscript {
ext {
// ...
firebaseMessagingVersion = '21.1.0'
}
}
These steps are worked for me.

Your question is posted to the official repository issue: https://github.com/zo0r/react-native-push-notification/issues/1979
if you are looking for the answer go to the comment:
https://github.com/zo0r/react-native-push-notification/issues/1979#issuecomment-839224339
It worked for me.

try with updating the npm package.
"react-native-push-notification": "^7.3.0"
by cleaning the cache also
cd android && ./gradlew clean

I update these tow files:
package.json :
"react-native-push-notification": "^7.2.2" to "react-native-push-notification": "^7.3.0"
android\app\build.gradle :
implementation 'com.google.firebase:firebase-analytics:17.3.0' to implementation 'com.google.firebase:firebase-analytics:19.0.0'
and its worked!

Related

found 1 high severity vulnerability (react-native-svg)

I'm trying to create a SVG component.
I have this problem after run command "npm i".
I think versions between packages aren't compatible.
How to fix this or create SVG component without react-native-svg package?
Thank a lot.enter image description here
Add the following to package.json:
{
// scripts, dependencies, etc.
"resolutions": {
"css-what": "5.0.1"
},
}
Remove lock file. Install the packages. Check if the app is still working. If works then keep the configuration (and ignore the warnings) else revert it.
Since you are using npm, you may wanna first refer this thread: npm equivalent of yarn resolutions?

react native problem with creating apk: gradle mergeDexRelease

My app works well on react-native-run-android and on gradlew clean provide me build success.
I used to check and creating the apk by using gradlew assembleRelease.
Recently, I faced an error while trying to create the APK and I cant find the right solution.
as far as I understand, some problem with the build.gradle or any gradle settings - the last feature I put was the mauron background geolocation (im not sure if that cause the problem).
I tried:
on gradle.properties :
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4608m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
in build.gradle I added: implementation 'androidx.multidex:multidex:2.0.1' in the dependencies.
3.
defaultConfig {
...
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
// multiDexEnabled true
}
The gradle I used was 6.3. So I upgraded (downloaded from their website v7 but I think the project is still under 6.3).
My question is:
If the app works and build successfuly, was the error because of my code or the gradle settings?
Im over a week with that problem and out of any clue how to get it work.
the error I get:
> Task :app:mergeDexRelease FAILED
D8: Program type already present: org.apache.commons.io.Charsets
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: org.apache.commons.io.Charsets
full picture: https://ibb.co/87pFnv1 , https://ibb.co/FxB8PWX
could anyone help me with it?
The error is not about multidex. It clearly says that one of your package is trying to add a library which is already there.
Since you have the name of the library you can put conditional implementation in your build.gradle to avoid redundant implementation.
for example
Implementation('new package that has module'){
exclude module: 'module to exclude'
}
Finally I solved the problem, Thanks Shashank Shekhar for directing me to the correct problem.
I used mauron85/react-native-background-geolocation package, was working fine until I tried to create apk.
in mauron85 issue #505 there was similar problem and someone fixed it by forking and maintaining the repo.
if anyone face that issue in future, I recommend to use #darron1217/react-native-background-geolocation as it solved the error.
Resolved: I have two packages #react-native-masked-view/masked-view (from previous developer) and #react-native-community/masked-view. Just remove #react-native-masked-view/masked-view package and try build.
https://github.com/react-native-masked-view/masked-view/issues/100#issuecomment-841634389 Thanks to: Navipro70

Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class in angular 8 [duplicate]

This question already has answers here:
error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
(33 answers)
Closed 2 months ago.
ERROR in node_modules/#angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
2801 export declare class HttpClientModule {
restart your server...
terminate server for windows
ctrl + C
start again
ng serve
I had the same issue.
I was going through comments here https://github.com/angular/angular/issues/35399 for solution.
I simple ran ng serve --prodand the error was gone. After that I even ran ng serve.
Other solutions proposed are
Ensure that the tsconfig.json of your library has set "importHelpers": true
Add "enableIvy": false to compilerOptions in tsconfig.app.json
Adding "postinstall": "ngcc" to scripts: {...} in package.json then run npm run postinstall solved problem.
if you still want to keep the Anuglar Ivy and AOT advantage
Simply restart the server (press ctrl+c on the prompt) and then, run ng serve again.
I had the same issue. Then I realized that previously I've some changes in app.module.ts Every time you made changes in app.module.ts remember restart the server process.
I had the same issue. I was adding service to module i.e. app.module.ts's imports array instead of adding it to the providers array.
app.module.ts
#NgModule({
imports: [
MyService // wrong here
],
providers: [
MyService // should add here
]
})
export class EventsModule { }
For me I had a Pipe declared in my 'imports' in my module. Apparently many things can produce this error. I do not suggest you disable IVY, as that is not the problem.
Setting "aot": false inside angular.json file worked for me.
I terminated the current build and restarted it again.
i.e ng serve solved my error. Hope it helps.
In my case, I had included HttpClientModule run running the Angular server.
The below solution works best for my case
Just Close the Server, and reopen it.
It will work.
Working within an NX workspace I just came across this issue.
After a lot of searching I realised that the internal library that I just created had by default Ivy turned off.
I do have it on everywhere else. And yes, even for my libraries. They're only internal to the monorepo we don't expose any of them so we don't want to have an extra step to compile them with the deprecated view engine instructions and later on run ngcc onto it to turn that into Ivy code.
Conclusion: I just forgot to set
"angularCompilerOptions": {
"enableIvy": true
}
on my newly created library and the default is false which wasn't working in my case.
I had same issue in ubuntu. But when I used sudo bash command and executed ng serve. It resolve the issue
I had the same problem, it seems like there is a lot of ways to trigger the problem. I recommend trying to verify the .component, .module and the app.module declarations. Mine was triggered because I've declared the .component in app.module instead of the .module.
This happened to me in VSCode with another module after installing it with npm install. This is most likely related to how the Angular language service extension works and the quickest way to solve it was to restart the IDE.
this problem caused by angular extension and snippets in vscode
be careful not to install obsolete extensions like Angular Extension Pack and Angular Language Service
enter image description here

Cannot find module './src/data' with vue-cli

I created a project with vue-cli 4.1.1, and after running yarn serve, i got the following error
Error: [BABEL] C:\dev\vuestudy\src\main.js: Cannot find module './src/data' (While processing: "C:\\dev\\vuestudy\\node_modules\\#vue\\cli-plugin-babel\\preset.js")
Any tips on this?
Thanks in advance.
UPDATE:
Kousha and Dave are right,after waiting for the core-js package update, I created a new project, and now it's working.
It looks like there's been a bad build of npm package core-js-compat. This is a deep-down dependency of Babel. Lots of things will be affected, things that use Babel.
You will experience this problem if you have core-js-compat v.3.4.6. You can check this by doing npm list core-js-compat. The problem is apparently fixed by v.3.4.7, which was pushed out pretty quickly, about half-an-hour later, but unfortunately it takes a while to spread out through the repositories. You can either wait until an npm update gets you v.3.4.7 or you can go manually download v.3.4.7 if you want to get going right away.
This is a bug with core-js-compat v3.4.6, but already the fix has gone with v3.4.7. See https://github.com/zloirock/core-js/issues/712 for more detail.
You may be able to force install the not-broken version with
npm i core-js-compat#3.4.7 --save
It worked on my machineā„¢
With Vue / Nuxt, you can delete package-lock.json and node_modules and do an npm install to fix this issue.

No signature of method: com.crashlytics.tools.gradle.CrashlyticsPlugin On Mac [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Below error while gradle sync Failed in Mac.
CONFIGURE FAILED in 3s
ERROR: No signature of method: com.crashlytics.tools.gradle.CrashlyticsPlugin.findObfuscationTransformTask() is applicable for argument types: (java.lang.String) values: [Debug]
Project works fine in Windows
There seems to be a problem with the version "1.28.0" of "io.fabric.tools:gradle".
I corresponded as follows
classpath 'io.fabric.tools:gradle:1.+'
Change to the following code
classpath 'io.fabric.tools:gradle:1.27.1'
I hope the fabric team will respond
Its problem with fabric tools that added in build.gradle app level
To solve this issue
go to build.gradle app level and find the below code
change this
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
to this
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
}
try with other versions like 1.28 if above version not working.
avoid using + in version codes and also that stops the auto update.
In my case, the Gradle Build Task was failing with the latest version(1.28.0) of Fabric Gradle Plugin. Downgrading to version 1.27.1 resolved this issue. There has been a Fabric Gradle Plugin release recently on 15th March 2019.
For users facing this issue and have added the Fabric Gradle Plugin as
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
...
}
need to replace with
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
...
}