darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 130 forks source link

2.0.0 incompatibility with cordova-plugin-camera 4.1.0 and cordova-open #101

Open marcomilone opened 4 years ago

marcomilone commented 4 years ago

Hello maintainer and everybody,

I obviously tested with those plugins only (everything else disabled)

I'm here because this plugin doesn't implement startActivityForResult and I was needing it.

Goal needed: save an mp3 using an external application.

Here the tests:

<plugin name="cordova-plugin-camera" spec="4.1.0" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="2.0.0" />

They are incompatible (last version for both atm). Order is respected as asked in the plugin how-to-use description.

I also tried:

<plugin name="cordova-plugin-camera" spec="4.0.3" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="2.0.0" />

and

<plugin name="cordova-plugin-camera" spec="4.0.2" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="2.0.0" />

I didn't tried further downgrading cordova-plugin-camera

I can say the same thing for cordova-open (1.1.0) incompatible with com-darryncampbell-cordova-plugin-intent (2.0.0) cordova-open is "similar", so I will set it apart

I made it work with previous version: 1.3.0

This works for me:

<plugin name="cordova-open" spec="1.1.0" />
<plugin name="cordova-plugin-camera" spec="4.1.0" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="1.3.0" />

Note that:

  • the plugins are installed, but build fails.
  • only 2 plugins "cordova-plugin-camera" and "com-darryncampbell-cordova-plugin-intent"
  • changing the version to 1.3.0 make it compatible
  • compiling with 2.0.0 ONLY (1 plugin only) is a success

I'm using PhonegapBuild: here the compile log (cutting away not interesting parts)

(2 plugins here)

Build Date: 2020-04-13 14:47:57 +0000
--------------------------------------------------------------------------------
PREPARE OUTPUT
--------------------------------------------------------------------------------
Generating platform-specific config.xml from defaults for android at /var/gimlet/tmp/47198279805060/2917001/app/src/main/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
[Gradle Properties] Preparing Configuration
[Gradle Properties] File missing, creating file with Cordova defaults.
[Gradle Properties] Appending default configuration properties
[Gradle Properties] Appending configuration item: org.gradle.daemon=true
[Gradle Properties] Appending configuration item: org.gradle.jvmargs=-Xmx2048m
[Gradle Properties] Appending configuration item: android.useDeprecatedNdk=true
[Gradle Properties] Appending custom configuration properties
[Gradle Properties] Updating and Saving File
Merging and updating files from [www, ../platform_www] to ../app/src/main/assets/www
  mkdir ../app/src/main/assets/www/cordova-js-src
  mkdir ../app/src/main/assets/www/cordova-js-src/android
  copy  ../platform_www/cordova-js-src/android/nativeapiprovider.js 
  [many copy] 

Wrote out android application name "MyApp" to /var/gimlet/tmp/47198279805060/2917001/app/src/main/res/values/strings.xml
Wrote out Android package name "com.app.my" to /var/gimlet/tmp/47198279805060/2917001/app/src/main/java/com/app/my/debug_app/MyApp_Debug.java
Updating icons at ../app/src/main/res
  copy  res/icons/android/mipmap-hdpi.png ../app/src/main/res/mipmap-hdpi/ic_launcher.png (new file)
  copy  res/icons/android/mipmap-mdpi.png ../app/src/main/res/mipmap-mdpi/ic_launcher.png (new file)
  copy  res/icons/android/mipmap-xhdpi.png ../app/src/main/res/mipmap-xhdpi/ic_launcher.png (new file)
  copy  res/icons/android/mipmap-xxhdpi.png ../app/src/main/res/mipmap-xxhdpi/ic_launcher.png (new file)
  copy  res/icons/android/mipmap-xxxhdpi.png ../app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (new file)
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
--------------------------------------------------------------------------------
PLUGIN OUTPUT
--------------------------------------------------------------------------------
Fetching plugin "cordova-plugin-camera" via npm
Installing "cordova-plugin-camera" at "4.1.0" for android
Subproject Path: CordovaLib
Subproject Path: app
Fetching plugin "com-darryncampbell-cordova-plugin-intent" via npm
Installing "com-darryncampbell-cordova-plugin-intent" at "2.0.0" for android
Subproject Path: CordovaLib
Subproject Path: app

--------------------------------------------------------------------------------
PROJECT PROPERTIES
--------------------------------------------------------------------------------
# This file was originally created by the Android Tools, but is now
# used by cordova-android to manage the state of the various third party
# libraries used in your application

# This is the Library Module that contains the Cordova Library, this is not
# required when using an AAR

# This is the application project.  This is only required for Android Studio Gradle projects

# Project target.
target=android-28
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:27.+
cordova.system.library.2=androidx.core:core:1.1.0
--------------------------------------------------------------------------------
COMPILE OUTPUT
--------------------------------------------------------------------------------
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
:wrapper

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.10.3/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing

> Configure project :app
Exception while marshalling /opt/android-sdk/build-tools/26.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/build-tools/28.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/extras/google/instantapps/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platform-tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platforms/android-28/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platforms/android-29/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/build-tools/26.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/build-tools/28.0.3/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/extras/google/instantapps/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platform-tools/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platforms/android-28/package.xml. Probably the SDK is read-only
Exception while marshalling /opt/android-sdk/platforms/android-29/package.xml. Probably the SDK is read-only

> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest
> Task :CordovaLib:processDebugManifest
> Task :app:preDebugBuild
> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript
> Task :app:checkDebugManifest
> Task :app:generateDebugBuildConfig
> Task :app:prepareLintJar
> Task :app:generateDebugSources
> Task :CordovaLib:compileDebugRenderscript
> Task :CordovaLib:generateDebugBuildConfig
> Task :CordovaLib:generateDebugResValues
> Task :CordovaLib:generateDebugResources
> Task :CordovaLib:packageDebugResources
> Task :CordovaLib:generateDebugRFile
> Task :CordovaLib:prepareLintJar
> Task :CordovaLib:generateDebugSources
> Task :CordovaLib:javaPreCompileDebug

> Task :CordovaLib:compileDebugJavaWithJavac

Note: /var/gimlet/tmp/47198279805060/2917001/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :CordovaLib:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
> Task :app:javaPreCompileDebug
> Task :app:mainApkListPersistenceDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:processDebugManifest
> Task :app:processDebugResources

> Task :app:compileDebugJavaWithJavac

> Task :app:compileDebugNdk NO-SOURCENote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :app:compileDebugSources
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders
> Task :app:generateDebugAssets
> Task :CordovaLib:mergeDebugShaders
> Task :CordovaLib:compileDebugShaders
> Task :CordovaLib:generateDebugAssets
> Task :CordovaLib:packageDebugAssets
> Task :app:mergeDebugAssets
> Task :app:validateSigningDebug
> Task :app:signingConfigWriterDebug
> Task :app:transformClassesWithDexBuilderForDebug

> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
34 actionable tasks: 34 executed
D8: Program type already present: android.support.v4.app.INotificationSideChannel

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel

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

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
Error: /var/gimlet/tmp/47198279805060/2917001/gradlew: Command failed with exit code 1 Error output:
Note: /var/gimlet/tmp/47198279805060/2917001/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides 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.
D8: Program type already present: android.support.v4.app.INotificationSideChannel

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel

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

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
    at ChildProcess.whenDone (/var/gimlet/tmp/47198279805060/2917001/cordova/node_modules/cordova-common/src/superspawn.js:135:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
darryncampbell commented 4 years ago

I really don't know, it could be related to the version of the Android support libraries - I have changed this over the years at the requests of a number of people, e.g. (https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/commit/99d1e8b9fc39e4e77fa69c63c23debf0dc9fdbdc#diff-53f390d375398624afe1cfe1125f42bf). Perhaps try an earlier version if this plugin like 1.0.0

marcomilone commented 4 years ago

Hello, thanks for your fast reply.

As said, with 1.3.0 is working flawlessly (are compatible).

Many thanks,

darryncampbell commented 4 years ago

Aha, I mis-understood,

In that case I suspect that the root cause is a mis-match between the support libraries and Android X. Is there a reason you need to move to 2.0.0? The only difference between 1.3.0 and 2.0.0 should be the introduction of Android X.

marcomilone commented 4 years ago

Hi again, I understand and don't understand.

Same exact project compile with 2.0.0. Don't compile with 2.0.0 AND camera plugin. I opened the issue only to let you know.

The only reason I used 2.0.0 is because I tried to compile without specifying the plugin's versions (spec), that means that every plugin is downloaded at last version. I always give a try. If everything is good, I lock with last versions.

Many thanks for your useful plugin. I'm using your super fantastic plugin with 1.3.0 because is working. (don't like "intentShim" name...)