My android artifacts get published with a `-androi...
# multiplatform
m
My android artifacts get published with a
-android
suffix and this ruins the build system. For example I have
my-module-core
and
my-module-foo
that depends on core, these get published under
com.example:my-module-foo-android:1.0.0
. Which would be fine but when I try to pull this artifact in an android app I get this error:
Could not find 'com.example:my-module-core:1.0.0'
, this I guess means that
my-module-foo-android
is expecting something without the suffix
m
Did you apply the
kotlin-android
plugin to your android app?
👍 1
Did you publish the kotlin metadata (what would be published as
my-module-foo
containing pointer to the
-android
variant)?
m
@Matt Nelson how do I check that?
m
Here's what directories look like on Maven Central , for example, my base32 encoding library.
m
okay, looks pretty similar to mine
m
clicking on the
encoding-base32
dir, then the
1.1.3
dir shows all the jars, javadocs, etc. The one we wanna look at is
encoding-base32-1.1.3-kotlin-tooling-metadata.json
so when your android app pulls from Maven for
com.example:my-foo-module:1.0.0
, it will pull down that module, check the available
platformType
, and then provide you with the appropriate
-android
variant.
m
hmm, inside
~/.m2/repository/com/example/
I only have
*-android
folders, so I guess that means I don't have the metadata
m
that is probably why. run from terminal
./gradlew tasks | grep "publish"
and see if you have something that relates to publishing the kotlin metadata.
m
doesn't seem to be
m
publishKotlinMultiplatformPublicationTo*
`Local`/`LocalRepository`/`MavenRepository`
that should be getting called if you just did
./gradlew publishToMavenLocal
m
okay, that makes sense, I was not calling
publishToMavelLocal
, was calling something else. This fixed it but I've hit another issue
Copy code
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.example.client.BuildConfig found in the following modules: multiplatform-sdk-core-debug-runtime-debug (com.example:multiplatform-sdk-core-android:25.0.0), multiplatform-sdk-full-debug-runtime-debug (com.example:multiplatform-sdk-full-android:25.0.0) and multiplatform-sdk-listening-debug-runtime-debug (com.example:multiplatform-sdk-listening-android:25.0.0)
(that class is not mine, it's generated by kotlin)
m
try changing in the
AndroidManifest
the
com.example
to something else, like
com.mendess
. Will need to create the new dirs and move some classes so the
package
updates accordingly.
m
how so? Edit the android manifest file manually?
m
wait. do you have both of these declared in your android app's dependencies block?
Copy code
dependencies {
    implementation(project(":my-module-foo"))
    implementation("com.example:my-foo-module:1.0.0")
}
If so, just comment out the
project
one after publishing to Maven Local.
m
no, in the android app I don't have it duplicated