0

Ionic 3 アプリケーションに firebase プッシュ通知を実装したいと考えています。ionic natice fcm プラグインを追加しました。しかし、次のコマンドを使用してアプリケーションをビルドすると

ionic cordova build android

しかし、それは私に以下のようなエラーを与えます:

ionic cordova build android
Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser

[12:22:34]  build dev started ...
[12:22:34]  clean started ...
[12:22:34]  clean finished in 31 ms
[12:22:34]  copy started ...
[12:22:34]  transpile started ...
[12:22:52]  transpile finished in 17.82 s
[12:22:52]  preprocess started ...
[12:22:52]  deeplinks started ...
[12:22:52]  deeplinks finished in 250 ms
[12:22:52]  preprocess finished in 297 ms
[12:22:52]  webpack started ...
[12:22:55]  copy finished in 20.24 s
[12:23:15]  webpack finished in 22.49 s
[12:23:15]  sass started ...
[12:23:19]  sass finished in 4.08 s
[12:23:19]  postprocess started ...
[12:23:19]  postprocess finished in 32 ms
[12:23:19]  lint started ...
[12:23:19]  build dev finished in 44.83 s
> cordova build android
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

        (truncated) ... aLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
        :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
        :CordovaLib:processDebugJavaRes UP-TO-DATE
        :CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
        :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
        :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
        :CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
        :CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
        :CordovaLib:bundleDebug UP-TO-DATE
        :prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
        :preReleaseBuild UP-TO-DATE
        :CordovaLib:preReleaseBuild UP-TO-DATE
        :CordovaLib:checkReleaseManifest
        :CordovaLib:prepareReleaseDependencies
        :CordovaLib:compileReleaseAidl UP-TO-DATE
        :CordovaLib:compileReleaseNdk UP-TO-DATE
        :CordovaLib:copyReleaseLint UP-TO-DATE
        :CordovaLib:mergeReleaseShaders UP-TO-DATE
        :CordovaLib:compileReleaseShaders UP-TO-DATE
        :CordovaLib:generateReleaseAssets UP-TO-DATE
        :CordovaLib:mergeReleaseAssets UP-TO-DATE
        :CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
        :CordovaLib:packageReleaseRenderscript UP-TO-DATE
        :CordovaLib:compileReleaseRenderscript UP-TO-DATE
        :CordovaLib:generateReleaseResValues UP-TO-DATE
        :CordovaLib:generateReleaseResources UP-TO-DATE
        :CordovaLib:packageReleaseResources UP-TO-DATE
        :CordovaLib:processReleaseManifest UP-TO-DATE
        :CordovaLib:generateReleaseBuildConfig UP-TO-DATE
        :CordovaLib:processReleaseResources UP-TO-DATE
        :CordovaLib:generateReleaseSources UP-TO-DATE
        :CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
        :CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
        :CordovaLib:processReleaseJavaRes UP-TO-DATE
        :CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
        :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
        :CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
        :CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
        :CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
        :CordovaLib:bundleRelease UP-TO-DATE
        :prepareComAndroidSupportSupportCompat2600Alpha1Library UP-TO-DATE
        :prepareComAndroidSupportSupportCoreUi2600Alpha1Library UP-TO-DATE
        :prepareComAndroidSupportSupportCoreUtils2600Alpha1Library UP-TO-DATE
        :prepareComAndroidSupportSupportFragment2600Alpha1Library UP-TO-DATE
        :prepareComAndroidSupportSupportMediaCompat2600Alpha1Library UP-TO-DATE
        :prepareComAndroidSupportSupportV42600Alpha1Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesAds900Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesAdsLite900Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesBase900Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesBasement1102Library UP-TO-DATE
        :prepareComGoogleAndroidGmsPlayServicesTasks1102Library UP-TO-DATE
        :prepareComGoogleFirebaseFirebaseAnalytics1102Library UP-TO-DATE
        :prepareComGoogleFirebaseFirebaseAnalyticsImpl1102Library UP-TO-DATE
        :prepareComGoogleFirebaseFirebaseCommon1102Library UP-TO-DATE
        :prepareComGoogleFirebaseFirebaseCore1102Library UP-TO-DATE
        :prepareComGoogleFirebaseFirebaseIid1102Library UP-TO-DATE
        :prepareComGoogleFirebaseFirebaseMessaging1102Library UP-TO-DATE
        :prepareDebugDependencies
        :compileDebugAidl
        :compileDebugRenderscript
        :generateDebugBuildConfig UP-TO-DATE
        :generateDebugResValues UP-TO-DATE
        :processDebugGoogleServices
        Parsing json file: D:\Projects\Code\Other\DailySheet\DailySheetMobileApp\platforms\android\google-services.json
        :generateDebugResources
        :mergeDebugResources
        :processDebugManifest UP-TO-DATE
        :processDebugResources
        :generateDebugSources
        :incrementalDebugJavaCompilationSafeguard UP-TO-DATE
        :compileDebugJavaWithJavac UP-TO-DATE
        :compileDebugNdk UP-TO-DATE
        :compileDebugSources UP-TO-DATE
        :mergeDebugShaders UP-TO-DATE
        :compileDebugShaders
        :generateDebugAssets
        :mergeDebugAssets UP-TO-DATE
        :transformClassesWithDexForDebug FAILED

        BUILD FAILED

        Total time: 1 mins 48.75 secs

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':transformClassesWithDexForDebug'.
        > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
        java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
        Lcom/google/android/gms/internal/zzee;

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
        Error: cmd: Command failed with exit code 1 Error output:
        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':transformClassesWithDexForDebug'.
        > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
        java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
        Lcom/google/android/gms/internal/zzee;

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

FCMプラグインを追加する前は、すべて正常に機能していました。私のプロジェクト情報は以下の通りです:

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 6.5.0
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.12
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.1.2
    Ionic Framework                 : ionic-angular 3.5.0

System:

    Node       : v7.8.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 4.2.0

また、すべてのプラグインとプラットフォームを削除して、再度追加しようとしました。しかし、解決策はありません!:(

4

2 に答える 2

0

アプリに Ionic ネイティブ FCM プラグインを追加する前に、Google Firebase コンソールでアプリを構成し、アプリのルート フォルダーにある GoogleService-info.plist と google-services.json に追加する必要があります。

プラグインを削除し、ファイルを追加してから、プラグインを再度追加してみてください。

于 2018-07-07T10:08:00.517 に答える