cordova-plugin-firebase: Build Error: Failed to execute aapt

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

About this issue

Most upvoted comments

So here is the reason it broke: https://github.com/arnesson/cordova-plugin-firebase/blob/5a3c08d4e2e9d372894d778ca8c8c3d7c3d72d0d/src/android/build.gradle#L20

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

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

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

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…

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!

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

Were you able to get it fixed? I’m getting the same error despite trying all other suggested options.

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

So here is the reason it broke: https://github.com/arnesson/cordova-plugin-firebase/blob/5a3c08d4e2e9d372894d778ca8c8c3d7c3d72d0d/src/android/build.gradle#L20

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!!

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

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

@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/

@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

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!

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

Generating signed bundle requires you to update the android gradle plugin to version 3.2.0 or higher Problems again !!!

Something needs to be worked on the attr/fontVariationSettings and attr/ttcIndex in values.xml. Is this related to compileSDK 28? Looks like we can’t update to SDK 28 which puts other errors, but keeping 27 will search for the values in values.xml which is not there!

Command failed with exit code 1 Error output: <home_path>/.gradle/caches/transforms-1/files-1.1/customtabs-27.1.1.aar/3dce91a2380bf657ee372a601e1fa4bb/res/values/values.xml:7:5-71: AAPT: error: resource android:attr/fontVariationSettings not found. <home_path>/.gradle/caches/transforms-1/files-1.1/customtabs-27.1.1.aar/3dce91a2380bf657ee372a601e1fa4bb/res/values/values.xml:7:5-71: AAPT: error: resource android:attr/ttcIndex not found. <project>/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:157: error: resource android:attr/fontVariationSettings not found. <project>/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:157: error: resource android:attr/ttcIndex not found. error: failed linking references.

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

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