mikepenz / Android-Iconics

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
https://mikepenz.dev
Apache License 2.0
5.18k stars 617 forks source link

Could not find com.mikepenz:library-typeface-api:unspecified #551

Closed smelfungus closed 3 years ago

smelfungus commented 3 years ago

About this issue

Hello! Seems like 5.2.2 release is introducing some issues with dependency resolution:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsProductionDebug'.
> Could not resolve all files for configuration ':app:productionDebugCompileClasspath'.
   > Could not find com.mikepenz:library-typeface-api:unspecified.
     Required by:
         project :app > com.mikepenz:iconics-core:5.2.2

Repos:

    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/kotlin/kotlinx/" }
        maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
    }

Deps:

    implementation "com.mikepenz:iconics-core:5.2.2"
    implementation "com.mikepenz:iconics-views:5.2.2"
    implementation "com.mikepenz:material-design-icons-dx-typeface:5.0.1.2-kotlin@aar"
    implementation "com.mikepenz:fontawesome-typeface:5.9.0.2-kotlin@aar"
    implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"

Details

mikepenz commented 3 years ago

It could be that a wrong variant of the pom file was left on the server, will republish as 5.2.3

mikepenz commented 3 years ago

published. please try with 5.2.3

marcauberer commented 3 years ago

The error above is gone, but a new error occurred:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.mikepenz:library-typeface-api:5.2.3.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mikepenz/library-typeface-api/5.2.3/library-typeface-api-5.2.3.pom
       - https://jcenter.bintray.com/com/mikepenz/library-typeface-api/5.2.3/library-typeface-api-5.2.3.pom
       - https://jitpack.io/com/mikepenz/library-typeface-api/5.2.3/library-typeface-api-5.2.3.pom
     Required by:
         project :app > com.mikepenz:iconics-core:5.2.3

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

What could be the reason for that?

Everything works perfectly with version 5.2.1

mikepenz commented 3 years ago

What do we learn from that? :D never touch a running system :D

the problem is that AS Artic fox canary 3 wants gradle 6.8 which will remove compile as such the old setup of dependencies wouldn't work anymore. + we tried to cleanup things.

mikepenz commented 3 years ago

Pretty sure I have it now :D really sorry again for this problem. @marcauberer please give me 30 more minutes for 5.2.4

marcauberer commented 3 years ago

No ploblem ;)

mikepenz commented 3 years ago

ok publishing completed. please try again with 5.2.4. 🤞

smelfungus commented 3 years ago

@mikepenz 5.2.4 works as intended! Thank you 🥇

mikepenz commented 3 years ago

thank you so much!

AllanWang commented 3 years ago

@mikepenz Is this still happening by any chance? Tried this with v5.3.0 (after a long time away from Android Studio), and I'm getting the same error.

It might be a mix of the Android 7.1.0-alpha05 plugin (what you're using now), and it's hard to replicate.

mikepenz commented 3 years ago

@AllanWang not as far as I know, using v5.3.0 in a few places without problems.

It sounds though to be more likely related to jitpack. The library itself is not officially published to jitpack due to security concerns, and only the binaries available from maven central are officially supported.

https://search.maven.org/artifact/com.mikepenz/iconics-core/5.3.0/aar

AllanWang commented 3 years ago

I'm confused how it's getting the same error if everything has been renamed though.

To clarify, I have a library on jitpack, and I'm using this library among many others within it. As of now the problem is only local so it might be an Android studio issue too.

mikepenz commented 3 years ago
Screenshot 2021-08-30 at 10 09 45

When this issue occurred, the version in the pom.xml was not properly defined due to the release process. But this should be good

AllanWang commented 3 years ago

I invalidated the cache and tried again with the same issue:

Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.mikepenz:library-typeface-api:unspecified.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mikepenz/library-typeface-api/unspecified/library-typeface-api-unspecified.pom
       - https://jcenter.bintray.com/com/mikepenz/library-typeface-api/unspecified/library-typeface-api-unspecified.pom
       - https://repo.maven.apache.org/maven2/com/mikepenz/library-typeface-api/unspecified/library-typeface-api-unspecified.pom
       - https://jitpack.io/com/mikepenz/library-typeface-api/unspecified/library-typeface-api-unspecified.pom
     Required by:
         project :app > com.mikepenz:google-material-typeface:4.0.0.1-kotlin

One difference is that the error is for google-material-typeface rather than for iconics-core

I believe the versions of all the icon packs themselves haven't changed, so is there a chance that those dependencies don't have the right pom.xml?

AllanWang commented 3 years ago

https://search.maven.org/artifact/com.mikepenz/google-material-typeface/4.0.0.1-kotlin/aar

See here. Do all the other deps need version bumps?

mikepenz commented 3 years ago

You are right the google-material-typeface one has unspecified: https://search.maven.org/artifact/com.mikepenz/google-material-typeface/4.0.0.1-kotlin/aar

mikepenz commented 3 years ago

Ah you were faster :D

mikepenz commented 3 years ago

Hmmm the outlined one is fine though: https://search.maven.org/artifact/com.mikepenz/google-material-typeface-outlined/4.0.0.1-kotlin/aar

It is suggested to include the typeface libraries via @aar at the end, which will result in non transitive resolving, as you anyways most likely use a newer iconics version (v5.3.x), so the typeface-api is retrieved from the core dependency

(https://github.com/mikepenz/Android-Iconics#2-choose-your-desired-fonts)

AllanWang commented 3 years ago

I actually do use @aar at the end, so something else is happening:

https://github.com/AllanWang/KAU/blob/version/buildSrc/src/main/kotlin/kau/Dependencies.kt#L91

In fairness, it works in that specific project but not for projects that include it (and only since I updated to java 11 and gradle 7.1.0 alpha 5), so it's a weird problem

mikepenz commented 3 years ago

@AllanWang that's very interesting. A resolution strategy may work in this case. To specify that all typeface-api should always resolve to a specific version.

the typefaces themself are usually not updated with new iconics versions as the typface-api stays the same

AllanWang commented 3 years ago

Is it difficult to push another update? I understand not needing to update it per version, though for that one specifically, the dep name is different which might be the problem that one update can solve.

See another icon, which only has a different version: https://search.maven.org/artifact/com.mikepenz/material-design-iconic-typeface/2.2.0.8-kotlin/aar

Also don't know too much about resolution strategies but I'm not sure if they can point to a completely different artifact id. I've used them to resolve specific versions

mikepenz commented 3 years ago

Not difficult, just time consuming as there are a ton of different typefaces. May could do it for that one though.

Also don't know too much about resolution strategies but I'm not sure if they can point to a completely different artifact id. I've used them to resolve specific versions

The problem is only the version being unspecified so using the resolution strategy you can give it that information which should resolve it.

AllanWang commented 3 years ago

Worked with resolution:

configurations.all {
    resolutionStrategy {
        dependencySubstitution {
            substitute module('com.mikepenz:library-typeface-api') using module("com.mikepenz:iconics-typeface-api:${kau.Versions.iconics}")
        }
    }
}
mikepenz commented 3 years ago

@AllanWang great. also triggered a republish of that single dependency as 4.0.0.2 it will take some time though until it becomes available