Android app close immediatly after running


#1

Hi,

I’m create an application with ionic 3. I run in android platform. My console display LAUNCH SUCCESS. But in my phone, the app closed immediatly.

My project.properties

target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:27.+
cordova.system.library.2=com.google.firebase:firebase-core:16.0.8
cordova.system.library.3=com.google.firebase:firebase-messaging:17.6.0
cordova.gradle.include.1=cordova-plugin-fcm-with-dependecy-updated/mobile-FCMPlugin.gradle
cordova.gradle.include.2=cordova-plugin-googlemaps/mobile-tbxml-android.gradle
cordova.system.library.4=com.google.android.gms:play-services-maps:16.0.0
cordova.system.library.5=com.google.android.gms:play-services-location:16.0.0
cordova.system.library.6=com.android.support:support-core-utils:27.+

My package.json

{
  "name": "com.my.mobileapp",
  "version": "1.2.5",
  "author": "My App",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "^7.2.13",
    "@angular/compiler-cli": "^7.2.13",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@angular/tsc-wrapped": "^4.4.6",
    "@ionic-native/call-number": "^4.20.0",
    "@ionic-native/core": "^4.20.0",
    "@ionic-native/diagnostic": "^4.20.0",
    "@ionic-native/email-composer": "^4.20.0",
    "@ionic-native/fcm": "^4.20.0",
    "@ionic-native/google-maps": "^4.21.0",
    "@ionic-native/native-storage": "^4.20.0",
    "@ionic-native/splash-screen": "^4.20.0",
    "@ionic-native/status-bar": "^4.18.0",
    "@ionic/cli-plugin-cordova": "^1.6.2",
    "@ionic/storage": "2.2.0",
    "@types/underscore": "^1.8.7",
    "call-number": "1.0.1",
    "cordova-android": "7.1.4",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-email-composer": "0.9.2",
    "cordova-plugin-fcm-with-dependecy-updated": "2.4.0",
    "cordova-plugin-googlemaps": "2.5.3",
    "cordova-plugin-ionic-keyboard": "2.0.5",
    "cordova-plugin-ionic-webview": "^4.0.1",
    "cordova-plugin-nativestorage": "2.3.2",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-whitelist": "1.3.3",
    "ionic-angular": "^3.9.2",
    "ionicons": "3.0.0",
    "moment": "^2.22.2",
    "mx.ferreyra.callnumber": "~0.0.2",
    "node-mailjet": "^3.2.1",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "tar": "^4.4.2",
    "underscore": "^1.9.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.3",
    "typescript": "^3.1.1"
  },
  "description": "An Ionic project",
  "cordova": {
    "platforms": [
      "android"
    ],
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-nativestorage": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-email-composer": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "mx.ferreyra.callnumber": {},
      "cordova-plugin-fcm-with-dependecy-updated": {},
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "Android key",
        "API_KEY_FOR_IOS": "IOS key",
        "PLAY_SERVICES_VERSION": "16.0.0",
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      }
    }
  }
}

I test remove an re install android platform and i test an other firebase version (15) but don’t build

My console result if I use firebase 15.0.0

Running app-scripts build: --platform android --target cordova
[10:35:38]  build dev started ... 
[10:35:38]  clean started ... 
[10:35:38]  clean finished in 3 ms 
[10:35:38]  copy started ... 
[10:35:38]  deeplinks started ... 
[10:35:38]  deeplinks finished in 340 ms 
[10:35:38]  transpile started ... 
[10:35:44]  transpile finished in 5.70 s 
[10:35:44]  preprocess started ... 
[10:35:44]  preprocess finished in less than 1 ms 
[10:35:44]  webpack started ... 
[10:35:44]  copy finished in 6.23 s 
[10:35:49]  webpack finished in 4.68 s 
[10:35:49]  sass started ... 
[10:35:50]  sass finished in 1.32 s 
[10:35:50]  postprocess started ... 
[10:35:50]  postprocess finished in 6 ms 
[10:35:50]  lint started ... 
[10:35:50]  build dev finished in 12.22 s 
> cordova run android --device
Android Studio project detected

ANDROID_HOME=/home/ange-marie/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
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.
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_qt4krza3yxxdj8labbwfqxfs.run(/home/ange-marie/App/app-mobile/platforms/android/app/build.gradle:149)
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild
 UP-TO-DATE

:CordovaLib:compileDebugAidl

:CordovaLib:compileDebugRenderscript

:CordovaLib:checkDebugManifest

:CordovaLib:generateDebugBuildConfig
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues

:CordovaLib:generateDebugResources

:CordovaLib:packageDebugResources

:CordovaLib:platformAttrExtractor
:CordovaLib:processDebugManifest

:CordovaLib:javaPreCompileDebug

:CordovaLib:processDebugJavaRes
 NO-SOURCE
:app:preBuild
 UP-TO-DATE
:app:preDebugBuild

:app:compileDebugAidl

:CordovaLib:processDebugResources

:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug

:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources

:app:createDebugCompatibleScreenManifests
:app:processDebugManifest

:app:splitsDiscoveryTaskDebug
:app:processDebugResources

:app:generateDebugSources
:app:javaPreCompileDebug

:app:compileDebugJavaWithJavac
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets

:app:transformClassesWithStackFramesFixerForDebug

:app:transformClassesWithDesugarForDebug
[10:35:56]  lint finished in 5.41 s 

:app:transformClassesWithDexBuilderForDebug

:app:transformDexArchiveWithExternalLibsDexMergerForDebug
 
FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* 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 4s
37 actionable tasks: 35 executed, 2 up-to-date
/home/ange-marie/App/app-mobile/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* 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 4s
[ERROR] An error occurred while running cordova run android --device (exit code 1).

Edit : I test without fcm, app is run correctly

Help me please