Cordova Slack Digest

Tue, 22 Nov 2022 08:22:30 GMT

User count: 4719

Join the conversation at slack.cordova.io

Channel #general (10 messages)


Mon, 21 Nov 2022 12:44:51 GMT

@sinan.demir says

Hello,

I am getting error in android build process.

Execution failed for task ‘:app:checkDebugDuplicateClasses’.

> cordova : 11.0.0 > android platform : 11.0.0

> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.scottyab.rootbeer.BuildConfig found in modules jetified-rootbeer-0.1.0-runtime (com.github.scottyab:rootbeer:0.1.0) and jetified-rootbeer-lib-0.1.0-runtime (com.scottyab:rootbeer-lib:0.1.0)
     Duplicate class com.scottyab.rootbeer.Const found in modules jetified-rootbeer-0.1.0-runtime (com.github.scottyab:rootbeer:0.1.0) and jetified-rootbeer-lib-0.1.0-runtime (com.scottyab:rootbeer-lib:0.1.0)
     Duplicate class com.scottyab.rootbeer.RootBeer found in modules jetified-rootbeer-0.1.0-runtime (com.github.scottyab:rootbeer:0.1.0) and jetified-rootbeer-lib-0.1.0-runtime (com.scottyab:rootbeer-lib:0.1.0)
     Duplicate class com.scottyab.rootbeer.RootBeerNative found in modules jetified-rootbeer-0.1.0-runtime (com.github.scottyab:rootbeer:0.1.0) and jetified-rootbeer-lib-0.1.0-runtime (com.scottyab:rootbeer-lib:0.1.0)
     Duplicate class com.scottyab.rootbeer.util.QLog found in modules jetified-rootbeer-0.1.0-runtime (com.github.scottyab:rootbeer:0.1.0) and jetified-rootbeer-lib-0.1.0-runtime (com.scottyab:rootbeer-lib:0.1.0)
     Duplicate class com.scottyab.rootbeer.util.Utils found in modules jetified-rootbeer-0.1.0-runtime (com.github.scottyab:rootbeer:0.1.0) and jetified-rootbeer-lib-0.1.0-runtime (com.scottyab:rootbeer-lib:0.1.0)```
	 
> Sourced from these two plugins;  *cordova-plugin-apkupdater, cordova-plugin-iroot*
plugins/cordova-plugin-apkupdater/plugin.xml
```<platform name="android">  
    <framework src="com.scottyab:rootbeer-lib:0.1.0"/>
</platform>```
plugins/cordova-plugin-iroot/plugin.xml
```<platform name="android">
    <framework custom="true" src="src/android/build-extras.gradle" type="gradleReference"/>
</platform>```
plugins/cordova-plugin-iroot/src/android/build-extras.gradle
```dependencies {
	implementation 'com.github.scottyab:rootbeer:0.1.0'
}```
Can you help with the most accurate solution?

Thank you.

Mon, 21 Nov 2022 13:30:45 GMT

@norman137 says

You have two packages, com.github.scottyab:rootbeer:0.1.0 and com.scottyab:rootbeer-lib:0.1.0 both implementing the same classes, e.g: com.scottyab.rootbeer.RootBeerNative

Which makes them incompatible. You'll have to track down which plugin(s) are adding these modules. Asking the respective authors may give you better insight on what can be done.

Mon, 21 Nov 2022 13:34:05 GMT

@norman137 says

If I were to take a wild guess, I'm going to guess that one of those native packages is deprecated in favour of the other and one of the plugins needs to be updated

Mon, 21 Nov 2022 13:36:57 GMT

@sinan.demir says

Thank you very much, Norman.

https://www.npmjs.com/package/cordova-plugin-apkupdater https://www.npmjs.com/package/cordova-plugin-iroot

I am using the latest versions of two plugins.

Mon, 21 Nov 2022 13:42:02 GMT

@sinan.demir says

Build is successful when I remove it from plugins/cordova-plugin-iroot/plugin.xml or plugins/cordova-plugin-iroot/src/android/build-extras.gradle. I don't know how logical this is?

Mon, 21 Nov 2022 14:03:58 GMT

@norman137 says

If PluginA depends on DepA and PluginB also depends on DepA.

PluginA will work if PluginB imports DepA, even if PluginA doesn't explicitly import DepA.

This works only because plugins are sources of your app and one of those plugins happens to import something that another plugin needs which will satisfy those symbols at build time.

If it's not obvious, this is not an ideal situation however, both plugins should declare their dependencies in the least forgiving way possible. That way Android can resolve to a single version of a dependency that satisfies all your libraries.

Your case however is a bit different. You have two plugins importing two different packages, but those two packages are implementing the same classes, which is why you had conflicts.

Mon, 21 Nov 2022 14:05:37 GMT

@norman137 says

Looking at it a bit deeper, this is kind of a problem on the native package author.

They use com.scottyab:rootbeer-lib on maven, but com.scottyab:rootbeer on jitpack, so as far as Gradle is concerned, they are two different dependencies I think. One plugin might be pulling the package from maven, while the other might be pulling from jitpack, causing the duplicate issue.

Mon, 21 Nov 2022 15:32:09 GMT

@sinan.demir says

The same package was added in two different plugins with two different methods.

I made the following change in “plugins/cordova-plugin-iroot/plugin.xml”.

     <framework custom="true" src="src/android/build-extras.gradle" type="gradleReference"/>
</platform>```
I removed it.

```<platform name="android">
     <framework src="com.scottyab:rootbeer-lib:0.1.0"/>
</platform>```
I used it.

Then I tested it. It worked successfully. Do you think that made sense?

Mon, 21 Nov 2022 16:14:26 GMT

@norman137 says

I think so. I'm not sure if there are any differences between the two native packages, but they both appear to be the same, so as long as both plugins are using the same id, it should work.

Mon, 21 Nov 2022 21:04:22 GMT

@sdemir says

Thank you very much for your help Norman.

Channel #cordova-android (2 messages)


Mon, 21 Nov 2022 20:17:55 GMT

@thepsion5 says

Has anyone had an issue getting WebView Debugging to turn off when using Ionic and Cordova to build a release version? I've tried adding android:debuggable="false" to AndroidManifest.xml but so far the only thing that has worked has been to literally go into SystemWebViewEngine.java and comment out the second line here:

    enableRemoteDebugging();
}```
But I can't figure out what's setting that debuggable flag. I'd appreciate any tips in figuring it out, since modifying java source code isn't really a viable solution

Mon, 21 Nov 2022 20:21:32 GMT

@norman137 says

Unless Ionic is overridding something, debuggable flag is set when the app is built in debug build (which is the default build type).

cordova build android --release will build a release build and the debuggable flag should be not set.

Channel #issue-tracker (1 messages)


Mon, 21 Nov 2022 10:32:58 GMT

@eugene.trusevich says

@eugene.trusevich has left the channel

Channel #help (1 messages)


Mon, 21 Nov 2022 10:32:39 GMT

@eugene.trusevich says

@eugene.trusevich has left the channel

Channel #ionic (1 messages)


Mon, 21 Nov 2022 10:32:53 GMT

@eugene.trusevich says

@eugene.trusevich has left the channel

Channel #dev (1 messages)


Mon, 21 Nov 2022 10:32:35 GMT

@eugene.trusevich says

@eugene.trusevich has left the channel

Channel #ios-control (1 messages)


Mon, 21 Nov 2022 10:32:56 GMT

@eugene.trusevich says

@eugene.trusevich has left the channel