You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/26 10:44:58 UTC

[GitHub] wenn32 opened a new issue #484: Cordova + Android Work Manager

wenn32 opened a new issue #484: Cordova + Android Work Manager
URL: https://github.com/apache/cordova-android/issues/484
 
 
   I choose WorkManager to make a scheduled service that would help me post data to server when cordova based app is closed.
   
   So, I start with including dependencies in build.gradle (Module:app)
   
   ```
   dependencies {
       implementation fileTree(dir: 'libs', include: '*.jar')
   
       //>>>>THIS LINE HERE IS FOR WORKMANAGER and MULTIDEX
       implementation "android.arch.work:work-runtime:1.0.0-alpha01"
       implementation 'com.android.support:multidex:1.0.3'
   
       // SUB-PROJECT DEPENDENCIES START
       implementation(project(path: ":CordovaLib"))
       compile "com.android.support:support-v4:24.1.1+"
       // SUB-PROJECT DEPENDENCIES END
   }
   ```
   
   Now I run following commands
   
   ```
   cordova clean
   cordova build android
   ```
   
   I get throw with an exception:
   
   ```
   Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
   
   java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
   ```
   
   So, I add this line
   
   ```
   android {
   
       defaultConfig {
           versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
           applicationId privateHelpers.extractStringFromManifest("package")
   
           //>>>>THIS LINE HERE
           multiDexEnabled true
   
           if (cdvMinSdkVersion != null) {
               minSdkVersion cdvMinSdkVersion
           }
       }
   
       lintOptions {
         abortOnError false;
       }
   
       compileSdkVersion cdvCompileSdkVersion
       buildToolsVersion cdvBuildToolsVersion
   ```
   I ran the clean and build commands again. Now, I get new exception:
   
   ```
   Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
   > java.io.IOException: Can't write [C:\Users\hjhkjn\Desktop\cordova\hjhkjnad\platforms\android\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\hjhkjn\Desktop\cordova\hjhkjnad\platforms\android\app\build\intermediates\transforms\desugar\debug\19.jar(;;;;;;**.class)] (Duplicate zip entry [19.jar:android/support/v4/content/PermissionChecker$PermissionResult.class]))
   ```
   I do get this error as well - https://i.stack.imgur.com/sZadD.png
   Any help would be appreciated. Thank you

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org