arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

Build Error: Failed to execute aapt #1084

Open brucomis opened 5 years ago

brucomis commented 5 years ago

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.

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.

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

viniciusbarbosa commented 5 years ago

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 (https://github.com/arnesson/cordova-plugin-firebase/issues/1084#issuecomment-505420901), 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 commented 5 years ago

minsdkversion

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

Try with this

leodiano commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@toFreshMilk paste your cordova info, please.

sagrawal31 commented 5 years ago

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 commented 5 years ago

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
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 {}

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 commented 5 years ago

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: https://github.com/arnesson/cordova-plugin-firebase/issues/1084#issuecomment-505420901)

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

nsksaisaravana commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

Cordova-plugin-firebasex

On Wed, Jun 19, 2019, 1:44 PM Exusmultimedia - Exus.com.co < notifications@github.com> wrote:

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 https://github.com/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?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/arnesson/cordova-plugin-firebase/issues/1084?email_source=notifications&email_token=AD2I3ZCZZ6AEMQUAS2RO7JLP3JV57A5CNFSM4HZD6YM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYCUDBQ#issuecomment-503660934, or mute the thread https://github.com/notifications/unsubscribe-auth/AD2I3ZBGT3QWUEXYDTJIOXLP3JV57ANCNFSM4HZD6YMQ .

viniciusbarbosa commented 5 years ago

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

nsksaisaravana commented 5 years ago

@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 commented 5 years ago

@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:inrun\'\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:inload\'\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 commented 5 years ago

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

viniciusbarbosa commented 5 years ago

@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 commented 5 years ago

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

i did the same but still getting below error :