Moxy icon indicating copy to clipboard operation
Moxy copied to clipboard

Fix broken jitpack publishing

Open aasitnikov opened this issue 4 years ago • 6 comments

Jitpack places all subprojects into single dependency. Not just it unnecessary increases size of users apk, but it can break compilation, as annotation processors cannot be placed in compile classpath in later versions of gradle. There's pom of moxy artifact.

That way, jitpack publishing should be either blocked or fixed.

aasitnikov avatar Oct 07 '19 06:10 aasitnikov

We have at least one user with this bug. This behavior is documented on Jitpack: https://jitpack.io/docs/BUILDING/#multi-module-projects Our problem is particularly tricky because Moxy's main module is called the same as repository, and Jitpack's all-in-one artifact name collides with our core module name: com.github.moxy-community:moxy:$moxyVersion. Jitpack users should actually use different dependency declaration style: implementation 'com.github.moxy-community.Moxy:moxy:2.0.2' as shown on Jitpack itself: https://jitpack.io/#moxy-community/Moxy/2.0.2 Not sure if that can be fixed, we have yet to decide what to do.

alaershov avatar Jan 06 '20 03:01 alaershov

If someone gets error like this — be aware that it may be caused by this bug. Spent several hours to figure this out.

* What went wrong:
Execution failed for task ':app:checkMirrorProductionDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.github.moxy_community.moxy.androidx.BuildConfig found in modules moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class com.github.moxy_community.moxy.material.BuildConfig found in modules moxy-material-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-material:2.0.2) and moxy-material-2.0.2-runtime.jar (com.github.moxy-community:moxy-material:2.0.2)
  Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-23.0.jar (com.google.guava:guava:23.0) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0)
  Duplicate class moxy.MvpAppCompatActivity found in the following modules: jetified-moxy-app-compat-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-app-compat:2.0.2), moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class moxy.MvpAppCompatDialogFragment found in the following modules: jetified-moxy-app-compat-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-app-compat:2.0.2), moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class moxy.MvpAppCompatFragment found in the following modules: jetified-moxy-app-compat-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-app-compat:2.0.2), moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class moxy.MvpBottomSheetDialogFragment found in modules moxy-material-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-material:2.0.2) and moxy-material-2.0.2-runtime.jar (com.github.moxy-community:moxy-material:2.0.2)
  Duplicate class moxy.ktx.DelegatesKt found in modules moxy-ktx-2.0.2.jar (com.github.moxy-community.moxy:moxy-ktx:2.0.2) and moxy-ktx-2.0.2.jar (com.github.moxy-community:moxy-ktx:2.0.2)
  Duplicate class moxy.ktx.MoxyKtxDelegate found in modules moxy-ktx-2.0.2.jar (com.github.moxy-community.moxy:moxy-ktx:2.0.2) and moxy-ktx-2.0.2.jar (com.github.moxy-community:moxy-ktx:2.0.2)
  Duplicate class moxy.ktx.MoxyKtxDelegate$field$1 found in modules moxy-ktx-2.0.2.jar (com.github.moxy-community.moxy:moxy-ktx:2.0.2) and moxy-ktx-2.0.2.jar (com.github.moxy-community:moxy-ktx:2.0.2)
  
  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
 ```

asfdfdfd avatar Jan 16 '20 14:01 asfdfdfd

If someone gets error like this — be aware that it may be caused by this bug. Spent several hours to figure this out.

* What went wrong:
Execution failed for task ':app:checkMirrorProductionDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.github.moxy_community.moxy.androidx.BuildConfig found in modules moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class com.github.moxy_community.moxy.material.BuildConfig found in modules moxy-material-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-material:2.0.2) and moxy-material-2.0.2-runtime.jar (com.github.moxy-community:moxy-material:2.0.2)
  Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-23.0.jar (com.google.guava:guava:23.0) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0)
  Duplicate class moxy.MvpAppCompatActivity found in the following modules: jetified-moxy-app-compat-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-app-compat:2.0.2), moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class moxy.MvpAppCompatDialogFragment found in the following modules: jetified-moxy-app-compat-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-app-compat:2.0.2), moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class moxy.MvpAppCompatFragment found in the following modules: jetified-moxy-app-compat-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-app-compat:2.0.2), moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-androidx:2.0.2) and moxy-androidx-2.0.2-runtime.jar (com.github.moxy-community:moxy-androidx:2.0.2)
  Duplicate class moxy.MvpBottomSheetDialogFragment found in modules moxy-material-2.0.2-runtime.jar (com.github.moxy-community.moxy:moxy-material:2.0.2) and moxy-material-2.0.2-runtime.jar (com.github.moxy-community:moxy-material:2.0.2)
  Duplicate class moxy.ktx.DelegatesKt found in modules moxy-ktx-2.0.2.jar (com.github.moxy-community.moxy:moxy-ktx:2.0.2) and moxy-ktx-2.0.2.jar (com.github.moxy-community:moxy-ktx:2.0.2)
  Duplicate class moxy.ktx.MoxyKtxDelegate found in modules moxy-ktx-2.0.2.jar (com.github.moxy-community.moxy:moxy-ktx:2.0.2) and moxy-ktx-2.0.2.jar (com.github.moxy-community:moxy-ktx:2.0.2)
  Duplicate class moxy.ktx.MoxyKtxDelegate$field$1 found in modules moxy-ktx-2.0.2.jar (com.github.moxy-community.moxy:moxy-ktx:2.0.2) and moxy-ktx-2.0.2.jar (com.github.moxy-community:moxy-ktx:2.0.2)
  
  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

Could you please explain your solution to that bug?

arseniy899 avatar Jan 14 '21 09:01 arseniy899

Could you please explain your solution to that bug?

As i could remember this message helped me https://github.com/moxy-community/Moxy/issues/63#issuecomment-570990776.

Could not remember details because i've removed Moxy from my project long time ago.

asfdfdfd avatar Jan 14 '21 10:01 asfdfdfd

Could you please explain your solution to that bug?

As i could remember this message helped me #63 (comment).

Could not remember details because i've removed Moxy from my project long time ago.

Well, it didn't helped me. But I've successfully excluded the problematic package with this adding to app gradle:

configurations {
        all {
            exclude group: "com.github.moxy-community.Moxy", module: "moxy-androidx"
        }
    }

arseniy899 avatar Jan 14 '21 13:01 arseniy899

@arseniy899 Could you share your problematic Gradle config? The fix from https://github.com/moxy-community/Moxy/issues/63#issuecomment-570990776 should work, and if it's not, it's worth investigating your config for other problems.

alaershov avatar Jan 15 '21 05:01 alaershov