Skip to content
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

Build Error: Failed to execute aapt #1084

Open
brucomis opened this issue Jun 18, 2019 · 72 comments
Open

Build Error: Failed to execute aapt #1084

brucomis opened this issue Jun 18, 2019 · 72 comments

Comments

@brucomis
Copy link

Hi there!
I'm getting this error when I use the plugin via cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

`cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to /home/aurumque/Cordova/luiscoba/platforms/android/app/build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to /home/aurumque/Cordova/luiscoba/platforms/android/cordova-android-support-gradle-release/luiscoba-cordova-android-support-gradle-release.gradle
Android Studio project detected
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to /home/aurumque/Cordova/luiscoba/platforms/android/app/build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to /home/aurumque/Cordova/luiscoba/platforms/android/cordova-android-support-gradle-release/luiscoba-cordova-android-support-gradle-release.gradle
Preparing Firebase on Android
ANDROID_HOME=/opt/android-sdk/
JAVA_HOME=/usr/lib/jvm/java-8-openjdk
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_16h44ethchy300tz3gs66tp8t.run(/home/aurumque/Cordova/luiscoba/platforms/android/app/build.gradle:151)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:javaPreCompileRelease UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:compileReleaseAidl UP-TO-DATE
:CordovaLib:packageReleaseRenderscript NO-SOURCE
:app:compileReleaseRenderscript UP-TO-DATE
:app:checkReleaseManifest UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:app:mergeReleaseShaders UP-TO-DATE
:app:compileReleaseShaders UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:processReleaseGoogleServices
Parsing json file: /home/aurumque/Cordova/luiscoba/platforms/android/app/google-services.json
:app:createReleaseCompatibleScreenManifests UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:fabricGenerateResourcesRelease
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources
:app:splitsDiscoveryTaskRelease UP-TO-DATE
:app:processReleaseResources/home/aurumque/.gradle/caches/transforms-1/files-1.1/customtabs-27.1.1.aar/66d15b7c1890e969f944ae6c7dea5271/res/values/values.xml: AAPT: error: resource android:attr/fontVariationSettings not found.

/home/aurumque/.gradle/caches/transforms-1/files-1.1/customtabs-27.1.1.aar/66d15b7c1890e969f944ae6c7dea5271/res/values/values.xml: AAPT: error: resource android:attr/ttcIndex not found.

/home/aurumque/Cordova/luiscoba/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:103: error: resource android:attr/fontVariationSettings not found.
/home/aurumque/Cordova/luiscoba/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:103: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 41 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processReleaseResources'.

Failed to execute aapt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s
FAILED
33 actionable tasks: 4 executed, 29 up-to-date
/home/aurumque/Cordova/luiscoba/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/aurumque/.gradle/caches/transforms-1/files-1.1/customtabs-27.1.1.aar/66d15b7c1890e969f944ae6c7dea5271/res/values/values.xml: AAPT: error: resource android:attr/fontVariationSettings not found.

/home/aurumque/.gradle/caches/transforms-1/files-1.1/customtabs-27.1.1.aar/66d15b7c1890e969f944ae6c7dea5271/res/values/values.xml: AAPT: error: resource android:attr/ttcIndex not found.

/home/aurumque/Cordova/luiscoba/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:103: error: resource android:attr/fontVariationSettings not found.
/home/aurumque/Cordova/luiscoba/platforms/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml:103: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 41 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processReleaseResources'.

Failed to execute aapt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s
`
I feel lost! Glad if anyone could help.
Thank you

@BuddyLReno
Copy link

In the same boat. We've been trying to fix this for 6 hours now.

@satoshionoda
Copy link

Firebase team made braking changes again on June 17 update
https://firebase.google.com/support/release-notes/android#update_-_june_17_2019

Presumably this caused the problem..

@mavericardo
Copy link

Same problem

@nsksaisaravana
Copy link

nsksaisaravana commented Jun 19, 2019

I am also having the same issue, last minute I couldn't build my android application, I lost my whole day to find this Cordova firebase plugin is raising the issue.

@inti25
Copy link

inti25 commented Jun 19, 2019

I tried add
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
to build.gradle but new issue occur :(

error: resource android:attr/fontVariationSettings not found.

error: resource android:attr/ttcIndex not found.

@aajain16
Copy link

aajain16 commented Jun 19, 2019

I tried add
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
to build.gradle but new issue occur :(

error: resource android:attr/fontVariationSettings not found.

error: resource android:attr/ttcIndex not found.

getting same issue spend whole day to resolve this problem but not got any solution.

@kaw7224169
Copy link

@#1083 (comment)

this work for me!

@Jonathan-Eid
Copy link

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-android-adapter
ionic cordova plugin add cordova-plugin-androidx-adapter

ionic cordova platform rm android
ionic cordova platform add android@8.0.0

This has solved my issues for today, most likely because it uses an older version of the firebase plugin

@tamsel12
Copy link

tamsel12 commented Jun 19, 2019

UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform “android” does not appear to be a valid cordova platform. It is missing API.js. android not supported.)

I am getting above error while running build for cordova android 8.

@ChronouSphere
Copy link

UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform “android” does not appear to be a valid cordova platform. It is missing API.js. android not supported.)

I am getting above error while running build for cordova android 8.

just run build command again

@tamsel12
Copy link

No , the same error only i am getting

Unable to load PlatformApi from platform. Error: Cannot find module 'properties-parser'
(node:30131) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported.)

@ChronouSphere
Copy link

ChronouSphere commented Jun 19, 2019

rsi

Works for me, thanks! but "ionic cordova plugin add cordova-plugin-android-adapter" doesn't exists
this is what i've done

  1. ionic cordova platform rm android
  2. ionic cordova plugin rm cordova-plugin-firebase
  3. ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
  4. ionic cordova plugin add cordova-plugin-androidx
  5. ionic cordova plugin add cordova-plugin-androidx-adapter
  6. ionic cordova platform add android
    Anyway, thanks!

@sagrawal31
Copy link

Give this a try https://github.com/wizpanda/cordova-plugin-firebase-lib/releases

@mavericardo
Copy link

I can not add the April version:

ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

ERROR:
(node:1549) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch plugin https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.

@mavericardo
Copy link

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-android-adapter
ionic cordova plugin add cordova-plugin-androidx-adapter

ionic cordova platform rm android
ionic cordova platform add android@8.0.0

This has solved my issues for today, most likely because it uses an older version of the firebase plugin

Did not work with me :(

@Sampath-Lokuge
Copy link

Sampath-Lokuge commented Jun 19, 2019

@ChronouSphere Thanks a lot. It works great!

https://stackoverflow.com/a/56668983/1077309

@Sampath-Lokuge
Copy link

@ruisilva450
Copy link

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-android-adapter
ionic cordova plugin add cordova-plugin-androidx-adapter

ionic cordova platform rm android
ionic cordova platform add android@8.0.0

This has solved my issues for today, most likely because it uses an older version of the firebase plugin

Thank you! I tried @ChronouSphere steps first but I was still on android@7.1.4 and when I installed android@8 the build completed successfully 😄

@herduin
Copy link

herduin commented Jun 19, 2019

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-android-adapter
ionic cordova plugin add cordova-plugin-androidx-adapter
ionic cordova platform rm android
ionic cordova platform add android@8.0.0
This has solved my issues for today, most likely because it uses an older version of the firebase plugin

Thank you! I tried @ChronouSphere steps first but I was still on android@7.1.4 and when I installed android@8 the build completed successfully 😄

Did not work for me :(, another idea?

@sagrawal31
Copy link

@sagrawal31
Copy link

We are maintaining a fork and we have fixed this issue for both cordova-android 7.x & 8.x.

@fortunatogreco
Copy link

I resolved with this commands:

ionic cordova platform rm android
ionic cordova plugin rm cordova-plugin-firebase
npm install cordova@9
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter
ionic cordova platform add android@8

@herduin
Copy link

herduin commented Jun 19, 2019

Hi! I am trying to solve this on any way but, every intent result in a error.

BUILD FAILED in 38s

> Task :app:compileReleaseJavaWithJavac FAILED
33 actionable tasks: 33 executed
/Volumes/Datos/GIT/CCASApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: /Volumes/Datos/GIT/CCASApp/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:9: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
                             ^
  symbol:   class NotificationManagerCompat
  location: package android.support.v4.app
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:11: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
                             ^
  symbol:   class NotificationCompat
  location: package android.support.v4.app
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/de/sitewaerts/cordova/documentviewer/FileProvider.java:3: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {
                                                            ^
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/de/sitewaerts/cordova/documentviewer/DocumentViewerPlugin.java:34: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
                                 ^
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/com/ionicframework/cordova/webview/IonicWebViewEngine.java:11: error: package android.support.annotation does not exist
import android.support.annotation.RequiresApi;
                                 ^
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/com/ionicframework/cordova/webview/IonicWebViewEngine.java:121: error: cannot find symbol
    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
     ^
  symbol:   class RequiresApi
  location: class IonicWebViewEngine.ServerClient
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:358: error: cannot find symbol
                    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
                    ^
  symbol: class NotificationManagerCompat
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:358: error: cannot find symbol
                    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
                                                                          ^
  symbol: variable NotificationManagerCompat
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                              ^
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                                                   ^
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:153: error: cannot find symbol
                    .setPriority(NotificationCompat.PRIORITY_MAX);
                                 ^
  symbol:   variable NotificationCompat
  location: class FirebasePluginMessagingService
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:149: error: package NotificationCompat does not exist
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
                                                    ^
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:148: error: cannot find symbol
                    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
                                   ^
  symbol:   variable NotificationCompat
  location: class FirebasePluginMessagingService
/Volumes/Datos/GIT/CCASApp/platforms/android/app/src/main/java/de/sitewaerts/cordova/documentviewer/DocumentViewerPlugin.java:500: error: cannot find symbol
                    Uri contentUri = FileProvider.getUriForFile(
                                                 ^
  symbol:   method getUriForFile(Context,String,File)
  location: class FileProvider
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

I resolved with this commands:

ionic cordova platform rm android
ionic cordova plugin rm cordova-plugin-firebase
npm install cordova@9
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter
ionic cordova platform add android@8

@tecmovilapp
Copy link

The marked answer is what worked for me:

https://stackoverflow.com/questions/56654226/ionic-cordova-app-stopped-compiling-after-googles-june-17th-firebase-sdk-update

cordova-plugin-firebase-lib@3.3.0 for cordova-android < 8.0.0
cordova-plugin-firebase-lib@4.0.0 for cordova-android > 8.0.0

@tom-hartz
Copy link

So here is the reason it broke:

compile 'com.google.firebase:firebase-auth:+'

Google Firebase Update - June 17, 2019
https://firebase.google.com/support/release-notes/android#version_1621

The following libraries are updated with this release:

Authentication version 18.0.0

We found a way to resolve this, and remain on target SDK version 27.

  1. hard clean: delete platforms/android

  2. ionic cordova build android (fails)

  3. update platforms/android/project.properties:

cordova.system.library.3=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
  1. update platforms/android/app/build.gradle (dependencies ~ln 266)
    compile "com.google.android.gms:play-services-tagmanager:16.0.8"
    compile "com.google.firebase:firebase-core:16.0.8"
    compile "com.google.firebase:firebase-messaging:17.5.0"
    compile "com.google.firebase:firebase-config:16.4.1"
    compile "com.google.firebase:firebase-perf:16.2.4"
  1. update platforms/android/cordova-plugin-firebase/cloud-build.gradle (in dependencies)
    compile 'com.google.firebase:firebase-auth:16.2.1'
  1. ionic cordova build android
    OR
    cd platforms/android
    ./gradlew build

@junryl
Copy link

junryl commented Jun 20, 2019

So here is the reason it broke:

compile 'com.google.firebase:firebase-auth:+'

Google Firebase Update - June 17, 2019
https://firebase.google.com/support/release-notes/android#version_1621

The following libraries are updated with this release:
Authentication version 18.0.0

We found a way to resolve this, and remain on target SDK version 27.

  1. hard clean: delete platforms/android
  2. ionic cordova build android (fails)
  3. update platforms/android/project.properties:
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
  1. update platforms/android/app/build.gradle (dependencies ~ln 266)
    compile "com.google.android.gms:play-services-tagmanager:16.0.8"
    compile "com.google.firebase:firebase-core:16.0.8"
    compile "com.google.firebase:firebase-messaging:17.5.0"
    compile "com.google.firebase:firebase-config:16.4.1"
    compile "com.google.firebase:firebase-perf:16.2.4"
  1. update platforms/android/cordova-plugin-firebase/cloud-build.gradle (in dependencies)
    compile 'com.google.firebase:firebase-auth:16.2.1'
  1. ionic cordova build android
    OR
    cd platforms/android
    ./gradlew build

Just changing "compile 'com.google.firebase:firebase-auth:+'" to "compile 'com.google.firebase:firebase-auth:16.2.1'" works fine too. Thanks.

@accerpcom
Copy link

Guys thanks for working fast on this one. The build is succeeded but no APK is generated.
Any ideas pls ?

@accerpcom
Copy link

Actually got an error

A problem occurred evaluating project ':app'.

Could not read script '/platforms/android/cordova-plugin-firebase/starter-build.gradle ' as it does not exist.

Anybody else has same error ?

@accerpcom
Copy link

I checked, the file actually exists , not sure why it cannot read it

@viniciusbarbosa
Copy link

Hi, @JeetuChoudhary!

When you ran: ionic cordova platform add android @ 8, have all the plugins been installed successfully?

The androidx-adapter plugin should solve all compatibility problems and internal dependency of other plugins.

To test, remove the cordova-plugin-intercom plugin from package.json, repeat all the steps and see if the build succeeds.

I took a look at the cordova-plugin-intercom and it cites to be compatible with ionic 1 and 2, what version of its ionic? And what version of the plugin are you using?

Abs

@JoseManueIbnzLora
Copy link

This work for me.
cordova-plugin-firebase -save
We found a way to resolve this, and remain on target SDK version 27.

cordova platform remove android
update platforms/android/project.properties:
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

update platforms/android/app/build.gradle (dependencies ~ln 266)

compile "com.google.android.gms:play-services-tagmanager:16.0.8"
compile "com.google.firebase:firebase-core:16.0.8"
compile "com.google.firebase:firebase-messaging:17.5.0"
compile "com.google.firebase:firebase-config:16.4.1"
compile "com.google.firebase:firebase-perf:16.2.4

update platforms/android/cordova-plugin-firebase/cloud-build.gradle (in dependencies)
compile 'com.google.firebase:firebase-auth:16.2.1'

cordova plugin add cordova-plugin-intercom

Update cordova/platforms/android/cordova-plugin-intercom/movilidapp-intercom.gradle (~ln 66):
apply plugin: 'com.google.gms.google-services'

Hi! I solved the error with the following steps:

cordova: 8.0.0
node: 8.11.0
ionic: 3.20.0
android: 8.0.0
targetBuild: 28

FIRST

ionic cordova platform rm android
ionic cordova plugin rm cordova-plugin-firebase

remove folder node_modules
IN SEQUENCE

npm i
cordova plugin add cordova-plugin-firebase-lib
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
ionic cordova platform add android@8

Resolved 100% for me. I was there 2 days ago with this problem and this was the solution.
APP build successful 100%. APK running successfully as well.
Hope this helps

Abs

Hey @viniciusbarbosa, by using your solution and a tweaking little bit in Intercom plugin configuration Which has the following under platform/android/cordova-plugin-intercom/app-intercom.gradle.
`
dependencies {

    // classpath 'com.android.tools.build:gradle:2.3.+'

    if (pushType == 'fcm') {

        // classpath 'com.google.gms:google-services:3.2.0'

    }
}

`
After commenting them out I am able to create build successfully. but When I run it in device, app crash before starting without any error. Any Idea what is happening?

Firebase+Intercom
This work for me!!
cordova: 8.0.0
node: 10.15.1
android: 7.1.4
targetBuild: 27

cordova-plugin-firebase -save

We found a way to resolve this, and remain on target SDK version 27.
cordova platform remove android

update platforms/android/project.properties:
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

update platforms/android/app/build.gradle (dependencies ~ln 266)
compile "com.google.android.gms:play-services-tagmanager:16.0.8"
compile "com.google.firebase:firebase-core:16.0.8"
compile "com.google.firebase:firebase-messaging:17.5.0"
compile "com.google.firebase:firebase-config:16.4.1"
compile "com.google.firebase:firebase-perf:16.2.4

update platforms/android/cordova-plugin-firebase/cloud-build.gradle (in dependencies)
compile 'com.google.firebase:firebase-auth:16.2.1'

cordova plugin add cordova-plugin-intercom

update cordova/platforms/android/cordova-plugin-intercom/movilidapp-intercom.gradle (~ln 66):
apply plugin: 'com.google.gms.google-services'

APP build successful 100%. APK running successfully as well.

@JeetuChoudhary
Copy link

JeetuChoudhary commented Jul 1, 2019

@viniciusbarbosa I have ionic@3.20.0 and cordova9.
yes, all the plugins are installed successfully and then I removed platform, plugin, node_module, and package-lock.json. Then repeated the steps you provided.

I have "cordova-plugin-intercom": "7.0.0", with "@ionic-native/intercom": "^5.8.0". IOS requires the latest version of intercom to create the build otherwise it causes the problem and it works well in IOS with Ionic 3. It also works in android with ionic 3 if you have android version >=@7.1.0 with Ionic 3. I have it in one of other project but that doesn't have firebase plugin so it works fine.

I will also test after removing the cordova-plugin-intercom plugin from package.json,

This firebase plugin is breaking my Two projects and making it hard for me. In one of my another project by using your steps, it still doesn't create the build. And that project doesn't have intercom but have analytics.
In that project, it gives the following error while building.

`BUILD FAILED in 8s
/platforms/android/gradlew: Command failed with exit code 1 Error output:

Note: /platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.
/platforms/android/app/src/main/AndroidManifest.xml:36:5-74 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib]

/platforms/android/CordovaLib/build/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures)`
and I have added the minSdk version to android/app/build.gradle. but no luck

Thanks for your time and help

@viniciusbarbosa
Copy link

Try again the described steps, however note, if your android version is 7.1.4, then you should use: cordova plugin add cordova-plugin-firebase-lib@3.3.0

See more details here: https://github.com/wizpanda/cordova-plugin-firebase-lib

Try and tell me what happens

@nsksaisaravana
Copy link

@viniciusbarbosa Build is successfull but Android SDK is failing with the below message

move minsdkversion to build files and sync project

@JeetuChoudhary
Copy link

@nsksaisaravana When you run it from the android studio it asks to do that. Run through command line it will work

@toFreshMilk
Copy link

hello....

BUILD FAILED in 14s
Error: appfolder/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: /appfolder/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all files for configuration ':app:releaseCompileClasspath'.

Failed to transform file 'libSecureLauncher.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
Failed to transform '/Users/ci/Desktop/project/KRX_MTS/platforms/android/app/libs/libSecureLauncher.jar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)

system info below..

im using ionic1 framework,

had tried things
cordova platform add android@8.0.0
cordova plugin fam
cordova plugin firebase
cordova plugin firebasex
cordova plugin firebasex-lib
cordova plugin androidx
cordova plugin androidx-adapter

..

i had tried solution in github almost but i failed.

please help

@viniciusbarbosa
Copy link

Hi, @toFreshMilk.

If you use the 3 plugins at the same time you will have problems.
cordova plugin firebase
cordova plugin firebasex
cordova firebasex-lib plugin

The attempt I succeeded, was with the cordova plugin firebasex-lib.
It is important to follow the order I have described here (#1084 (comment)),
more details here (https://github.com/wizpanda/cordova-plugin-firebase-lib).

MinSdk = 19 and TargetSdk = 28
cordova: 8.0.0
node: 8.11.0
ionic: 3.20.0
android: 8.0.0
targetBuild: 28

Hope this helps

Abs

@viniciusbarbosa
Copy link

minsdkversion

Hi, @nsksaisaravana!
MinSdk = 19 e TargetSdk = 28.

Try with this

@leodiano
Copy link

leodiano commented Jul 2, 2019

Is it possible to use this library (cordova-plugin-firebasex-lib) in ionic2 using typescript? How would this import look? Sorry for the question. 😕

@leodiano
Copy link

leodiano commented Jul 2, 2019

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
ionic cordova plugin add cordova-plugin-android-adapter
ionic cordova plugin add cordova-plugin-androidx-adapter

ionic cordova platform rm android
ionic cordova platform add android@8.0.0

This has solved my issues for today, most likely because it uses an older version of the firebase plugin

Are you using ionic2? How to import js plugin into typscript?

@toFreshMilk
Copy link

toFreshMilk commented Jul 2, 2019

Hi, @toFreshMilk.

If you use the 3 plugins at the same time you will have problems.
cordova plugin firebase
cordova plugin firebasex
cordova firebasex-lib plugin

The attempt I succeeded, was with the cordova plugin firebasex-lib.
It is important to follow the order I have described here (#1084 (comment)),
more details here (https://github.com/wizpanda/cordova-plugin-firebase-lib).

MinSdk = 19 and TargetSdk = 28
cordova: 8.0.0
node: 8.11.0
ionic: 3.20.0
android: 8.0.0
targetBuild: 28

Hope this helps

Abs

thank.

but i tried your advice aleardy.

just i use ionic1.

also,

If you use the 3 plugins at the same time you will have problems.
cordova plugin firebase
cordova plugin firebasex
cordova firebasex-lib plugin

i tried this plugins each. no together.

in my case,
i had created testapp by cordova app.
then, prepare them ( just firebase-lib, androidx, androidx adapter.. )

but failed build...

what the..? what problem?

@viniciusbarbosa
Copy link

viniciusbarbosa commented Jul 2, 2019

@toFreshMilk paste your cordova info, please.

@sagrawal31
Copy link

Is it possible to use this library (cordova-plugin-firebasex-lib) in ionic2 using typescript? How would this import look? Sorry for the question. 😕

Yes, you can use this. Can you confirm your cordova environment versions

@leodiano
Copy link

leodiano commented Jul 2, 2019

I'm having a hard time at this part.

Ionic:

   Ionic CLI                     : 5.2.1 (C:\Users\DELL\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.6.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 5 other plugins)

Utility:

   cordova-res : 0.5.1
   native-run  : 0.2.7

System:

 (C:\Program Files (x86)\Android\android-sdk)
   NodeJS            : v11.2.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10

  • AppModule
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import { Firebase } from 'cordova-plugin-firebase-lib/www/firebase';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
  providers: [
    StatusBar,
    SplashScreen,
    Firebase,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
  • AppComponent

import { Component } from '@angular/core';

import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { Firebase } from 'cordova-plugin-firebase-lib/www/firebase';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private firebase: Firebase
  ) {
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      this.splashScreen.hide();

      this.initFirebase();

    });
  }

  initFirebase() {
      this.firebase.getToken(function(token) {
        alert(`The token is ${token}`)
      }, function(error) {
        alert('Error getting token: ' + JSON.stringify(error))
      });
  }

}

ERROR in ./node_modules/cordova-plugin-firebase-lib/www/firebase.js
Module not found: Error: Can't resolve 'cordova/exec' in 'C:\Users\DELL\source\repos\myproject\node_modules\cordova-plugin-firebase-lib\www'

@viniciusbarbosa
Copy link

Hi, @leodiano!

You need to replace the cordova-plugin-firebase plugin with cordova-plugin-firebase-lib, and also use androidx and androidx-adapter.
Please follow my instructions for this comment: #1084 (comment))

According to your version of the android android, see the version of firebase-lib that you should install. Follow here: https://github.com/wizpanda/cordova-plugin-firebase-lib

Try exactly the steps outlined in my quoted comment and you will succeed. I went through this for 2 days after the Google update and finally found this solution stable. I've been able to replicate it several times.

Try and tell me. If you have questions just say it.

Abs

@leodiano
Copy link

leodiano commented Jul 2, 2019

Hi, @leodiano!

You need to replace the cordova-plugin-firebase plugin with cordova-plugin-firebase-lib, and also use androidx and androidx-adapter.
Please follow my instructions for this comment: #1084 (comment))

According to your version of the android android, see the version of firebase-lib that you should install. Follow here: https://github.com/wizpanda/cordova-plugin-firebase-lib

Try exactly the steps outlined in my quoted comment and you will succeed. I went through this for 2 days after the Google update and finally found this solution stable. I've been able to replicate it several times.

Try and tell me. If you have questions just say it.

Abs

@viniciusbarbosa I sent an invitation to your linkedin. Leonardo Calazans. If you can help me. I'm 3 days into it.

@JeetuChoudhary
Copy link

Try again the described steps, however note, if your android version is 7.1.4, then you should use: cordova plugin add cordova-plugin-firebase-lib@3.3.0

See more details here: https://github.com/wizpanda/cordova-plugin-firebase-lib

Try and tell me what happens

@viniciusbarbosa By uninstalling the intercom, it works. So now I have removed the intercom plugin and manually configured it in android.
Thanks for your help and time!

@leoalipazaga
Copy link

So here is the reason it broke:

compile 'com.google.firebase:firebase-auth:+'

Google Firebase Update - June 17, 2019
https://firebase.google.com/support/release-notes/android#version_1621

The following libraries are updated with this release:
Authentication version 18.0.0

We found a way to resolve this, and remain on target SDK version 27.

  1. hard clean: delete platforms/android
  2. ionic cordova build android (fails)
  3. update platforms/android/project.properties:
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
  1. update platforms/android/app/build.gradle (dependencies ~ln 266)
    compile "com.google.android.gms:play-services-tagmanager:16.0.8"
    compile "com.google.firebase:firebase-core:16.0.8"
    compile "com.google.firebase:firebase-messaging:17.5.0"
    compile "com.google.firebase:firebase-config:16.4.1"
    compile "com.google.firebase:firebase-perf:16.2.4"
  1. update platforms/android/cordova-plugin-firebase/cloud-build.gradle (in dependencies)
    compile 'com.google.firebase:firebase-auth:16.2.1'
  1. ionic cordova build android
    OR
    cd platforms/android
    ./gradlew build

this works me tnx!!

@nsksaisaravana
Copy link

nsksaisaravana commented Jul 4, 2019

@viniciusbarbosa @JeetuChoudhary I followed you guys recommended steps, it is building fine in Android but notification is not working.

I build it in IOS, it skipped the plugin (cordova plugin add cordova-plugin-firebase-lib) and it is expecting the cordova version 9.0.

@viniciusbarbosa
Copy link

@nsksaisaravana what's your cordova version?
if your cordova <= 8.1.1, then use cordova plugin add cordova-plugin-firebase-lib@4.0.0.
See more in https://github.com/wizpanda/cordova-plugin-firebase-lib/

@nsksaisaravana
Copy link

@viniciusbarbosa Thanks for your immediate info, unfortunately, it is not working. I have upgraded the Cordova to 9 as well but no luck.

Notification is not working.

@Jonathan-Eid
Copy link

Jonathan-Eid commented Jul 5, 2019 via email

@viniciusbarbosa
Copy link

@nsksaisaravana add me to linkedin and use the chat to talk, I'll help you. https://www.linkedin.com/in/viniciusbarbosa4/

@nsksaisaravana
Copy link

@viniciusbarbosa Thanks a for your great help. I was checking in the Android SDK, it was not working properly but I deployed in the store and it is working properly.

You saved me many days. @viniciusbarbosa

@nsksaisaravana
Copy link

nsksaisaravana commented Jul 9, 2019

@viniciusbarbosa anything different steps need to do for IOS???

i am getting below error

Failed to install 'cordova-plugin-firebase-lib': undefined
CordovaError: Promise rejected with non-error: '/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:439:in help!\': \u001b[31m[!] You cannot run CocoaPods as root.\u001b[39m (CLAide::Help)\n\n\u001b[4mUsage:\u001b[24m\n\n $ \u001b[32mpod\u001b[39m \u001b[32mCOMMAND\u001b[39m\n\n CocoaPods, the Cocoa library package manager.\n\n\u001b[4mCommands:\u001b[24m\n\n \u001b[32m+ cache\u001b[39m Manipulate the CocoaPods cache\n \u001b[32m+ env\u001b[39m Display pod environment\n \u001b[32m+ init\u001b[39m Generate a Podfile for the current directory\n \u001b[32m+ install\u001b[39m Install project dependencies according to versions from a\n Podfile.lock\n \u001b[32m+ ipc\u001b[39m Inter-process communication\n \u001b[32m+ lib\u001b[39m Develop pods\n \u001b[32m+ list\u001b[39m List pods\n \u001b[32m+ outdated\u001b[39m Show outdated project dependencies\n \u001b[32m+ repo\u001b[39m Manage spec-repositories\n \u001b[32m+ setup\u001b[39m Setup the CocoaPods environment\n \u001b[32m+ spec\u001b[39m Manage pod specs\n \u001b[32m+ update\u001b[39m Update outdated project dependencies and create new Podfile.lock\n\n\u001b[4mOptions:\u001b[24m\n\n \u001b[34m--silent\u001b[39m Show nothing\n \u001b[34m--version\u001b[39m Show the version of the tool\n \u001b[34m--verbose\u001b[39m Show more debugging information\n \u001b[34m--no-ansi\u001b[39m Show output without ANSI codes\n \u001b[34m--help\u001b[39m Show help banner of specified command\n\tfrom /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/command.rb:47:in run'\n\tfrom /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/bin/pod:55:in <top (required)>\'\n\tfrom /usr/local/bin/pod:22:in load'\n\tfrom /usr/local/bin/pod:22:in `

'\n'
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:29:15)
at
at process._tickCallback (internal/process/next_tick.js:189:7)

@tomavic
Copy link

tomavic commented Jul 9, 2019

@nsksaisaravana You could try https://github.com/dpa99c/cordova-plugin-firebase instead of firebase-lib

@viniciusbarbosa
Copy link

@nsksaisaravana

Look at a version of your Cordova-ios and check which version of the plugin you should install
https://github.com/wizpanda/cordova-plugin-firebase-lib/

@kapil303196
Copy link

So here is the reason it broke:

compile 'com.google.firebase:firebase-auth:+'

Google Firebase Update - June 17, 2019
https://firebase.google.com/support/release-notes/android#version_1621

The following libraries are updated with this release:
Authentication version 18.0.0

We found a way to resolve this, and remain on target SDK version 27.

  1. hard clean: delete platforms/android
  2. ionic cordova build android (fails)
  3. update platforms/android/project.properties:
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
  1. update platforms/android/app/build.gradle (dependencies ~ln 266)
    compile "com.google.android.gms:play-services-tagmanager:16.0.8"
    compile "com.google.firebase:firebase-core:16.0.8"
    compile "com.google.firebase:firebase-messaging:17.5.0"
    compile "com.google.firebase:firebase-config:16.4.1"
    compile "com.google.firebase:firebase-perf:16.2.4"
  1. update platforms/android/cordova-plugin-firebase/cloud-build.gradle (in dependencies)
    compile 'com.google.firebase:firebase-auth:16.2.1'
  1. ionic cordova build android
    OR
    cd platforms/android
    ./gradlew build

i did the same but still getting below error :

  • What went wrong:
    Execution failed for task ':app:mergeDebugResources'.

Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests