<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by swsisoftoryx on Medium]]></title>
        <description><![CDATA[Stories by swsisoftoryx on Medium]]></description>
        <link>https://medium.com/@swsisoftoryx?source=rss-bcc9492d36f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by swsisoftoryx on Medium</title>
            <link>https://medium.com/@swsisoftoryx?source=rss-bcc9492d36f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:03:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@swsisoftoryx/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Publishing Closed-Source (Proprietary) Android Libraries]]></title>
            <link>https://medium.com/@swsisoftoryx/publishing-closed-source-proprietary-android-libraries-3ffee8ae4b28?source=rss-bcc9492d36f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ffee8ae4b28</guid>
            <category><![CDATA[maven-central]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[dependencies]]></category>
            <category><![CDATA[closed-source]]></category>
            <category><![CDATA[libraries]]></category>
            <dc:creator><![CDATA[swsisoftoryx]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 23:11:09 GMT</pubDate>
            <atom:updated>2026-08-08T23:11:09.882Z</atom:updated>
            <content:encoded><![CDATA[<p>Many companies and commercial SDK vendors (like Stripe, Zoom, or Firebase) publish public dependencies (implementation(&quot;com.company.sdk:core:1.0.0&quot;)) so developers worldwide can use them, but <strong>keep their implementation code private and closed-source</strong>.</p><p>Here is the step-by-step guide to publishing a closed-source Android library:</p><h3>Step 1: Obfuscate &amp; Protect Implementation Code with R8/ProGuard</h3><p>By default, Java/Kotlin bytecode inside a compiled .aar file can easily be decompiled back to readable source code using tools like JADX. You <strong>must obfuscate internal logic</strong> before publishing.</p><p>In your library module’s build.gradle.kts:</p><pre>android {<br>    buildTypes {<br>        release {<br>            isMinifyEnabled = true // Enables R8 code obfuscation &amp; shrinking<br>            proguardFiles(<br>                getDefaultProguardFile(&quot;proguard-android-optimize.txt&quot;),<br>                &quot;proguard-rules.pro&quot;<br>            )<br>            // ProGuard rules that consumers&#39; apps automatically inherit<br>            consumerProguardFiles(&quot;consumer-rules.pro&quot;)<br>        }<br>    }<br>}</pre><h4>Configure proguard-rules.pro</h4><p>Keep your public API entry points intact while obfuscating all internal implementation details:</p><pre># Keep your public API classes visible so consumers can call them<br>-keep public class com.mycompany.sdk.PublicManager { *; }<br>-keep public class com.mycompany.sdk.models.** { *; }<br><br># All other internal classes, helpers, and utilities will be obfuscated (renamed to a, b, c)</pre><h3>Step 2: Disable Source Code Artifact Packaging</h3><p>Standard open-source publishing generates a -sources.jar containing your actual Kotlin/Java files. For closed-source libraries, you must <strong>disable source JAR generation</strong>.</p><p>In your library module’s build.gradle.kts inside the mavenPublishing block:</p><pre>mavenPublishing {<br>    // ❌ Do NOT package implementation source code<br>    // (Vanniktech plugin configuration)<br>    configure(com.vanniktech.maven.publish.AndroidSingleVariantLibrary(<br>        publishJavadocJar = false, // Or set to true if you generate javadoc HTML only<br>        sourcesJar = false         // Prevents source code from being uploaded<br>    ))<br>}</pre><h3>Step 3: Specify a Proprietary Commercial License in POM</h3><p>In the POM metadata block, replace open-source licenses (like Apache 2.0 or MIT) with your company’s proprietary Terms of Service URL:</p><pre>pom {<br>    name.set(&quot;Company Commercial SDK&quot;)<br>    description.set(&quot;Closed-source SDK for Enterprise integration.&quot;)<br>    url.set(&quot;https://mycompany.com/sdk-docs&quot;)<br><br>    licenses {<br>        license {<br>            name.set(&quot;Proprietary &amp; Commercial License&quot;)<br>            url.set(&quot;https://mycompany.com/terms/sdk-license&quot;)<br>            distribution.set(&quot;repo&quot;)<br>        }<br>    }<br>}</pre><h3>Step 4: Register Corporate Domain Namespace</h3><ol><li>Log in to <a href="https://central.sonatype.com/">Sonatype Central</a>.</li><li>Add your company’s domain as a namespace (e.g. com.mycompany).</li><li>Sonatype will ask you to add a temporary TXT record to your domain&#39;s DNS settings (e.g. via Cloudflare, Route53, GoDaddy) to prove corporate ownership.</li><li>Once verified, publish using your corporate Sonatype tokens!</li></ol><h3>Summary Checklist for Closed-Source Libraries:</h3><ul><li><strong>R8 / ProGuard Enabled</strong>: Internal implementation classes are renamed to a.b.c().</li><li><strong>No </strong><strong>-sources.jar Uploaded</strong>: Only compiled .aar binaries are pushed to Maven Central.</li><li><strong>Proprietary EULA License</strong>: POM file explicitly declares proprietary ownership.</li><li><strong>Public API Preserved</strong>: Only public interfaces specified in consumer-rules.pro remain accessible to SDK consumers.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ffee8ae4b28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish Android Library to Maven repository]]></title>
            <link>https://medium.com/@swsisoftoryx/publish-android-library-to-maven-repository-38086c2474bb?source=rss-bcc9492d36f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/38086c2474bb</guid>
            <dc:creator><![CDATA[swsisoftoryx]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 22:58:44 GMT</pubDate>
            <atom:updated>2026-08-08T22:58:44.655Z</atom:updated>
            <content:encoded><![CDATA[<p>Publishing an Android library to Maven Central used to be a daunting task involving Jira tickets and legacy Sonatype portals. With the new <strong>Sonatype Central Portal</strong> and <strong>Vanniktech’s Gradle Maven Publish Plugin</strong>, the process is smoother than ever.</p><p>In this guide, we’ll walk through the complete step-by-step setup to publish your library for free, plus a <strong>Troubleshooting Guide</strong> covering real-world errors you might encounter along the way.</p><h3>Prerequisites &amp; Account Setup</h3><p>Before configuring your project, complete these two quick setups:</p><h3>1. Claim your Namespace on Sonatype Central</h3><ol><li>Go to <a href="https://central.sonatype.com/">central.sonatype.com</a> and sign up.</li><li>Go to <strong>View Account</strong> -&gt; <strong>Namespaces</strong> -&gt; <strong>Add Namespace</strong>.</li></ol><ul><li>If you own a domain, use com.yourdomain.</li><li>If using GitHub, use io.github.your-github-username.</li></ul><ol><li>Verify ownership following the on-screen instructions (e.g., creating a temporary public GitHub repo with a verification code).</li><li>Under <strong>View Account</strong> -&gt; <strong>User Token</strong>, click <strong>Generate User Token</strong> and save your Username Token and Password Token.</li></ol><h3>2. Generate a GPG Key &amp; Upload it</h3><p>Maven Central requires cryptographically signed artifacts.</p><ol><li>Generate a GPG key pair:</li></ol><pre>gpg - full-generate-key</pre><ol><li><em>(Choose RSA 4096-bit and set a passphrase).</em></li><li>Get your 8-character Key ID:</li></ol><pre>gpg --list-secret-keys --keyid-format SHORT</pre><p><em>(e.g., </em><em>sec rsa4096/ABCDEFGH ... — </em><em>ABCDEFGH is your Key ID).</em></p><ol><li>Upload your Public Key to Ubuntu Keyserver:</li></ol><ul><li>Export public key: gpg --armor --export YOUR_KEY_ID</li><li>Copy the output and paste it into <a href="https://keyserver.ubuntu.com/"><strong>keyserver.ubuntu.com</strong></a> -&gt; <strong>Submit a key</strong>.</li></ul><h3>Step 1: Configure Your Gradle Files</h3><h3>1. Root build.gradle.kts</h3><p>Add the Vanniktech publishing plugin to your root build file:</p><pre>plugins {<br>    // ... existing plugins ...<br>    id(&quot;com.vanniktech.maven.publish&quot;) version &quot;0.29.0&quot; apply false<br>}</pre><h3>2. Library Module build.gradle.kts</h3><p>Open your library module’s build.gradle.kts (e.g., SwsiAddressCompose/build.gradle.kts)</p><pre>plugins {<br>    id(&quot;com.android.library&quot;)<br>    id(&quot;org.jetbrains.kotlin.android&quot;)<br>    id(&quot;com.vanniktech.maven.publish&quot;) // Apply Vanniktech plugin<br>}<br><br>mavenPublishing {<br>    // 1. Library coordinates<br>    coordinates(<br>        groupId = &quot;io.github.yourusername&quot;,<br>        artifactId = &quot;your-library-name&quot;,<br>        version = &quot;1.0.0&quot;<br>    )<br><br>    // 2. POM Metadata required by Maven Central<br>    pom {<br>        name.set(&quot;Your Library Name&quot;)<br>        description.set(&quot;A short description of what your Android library does.&quot;)<br>        url.set(&quot;https://github.com/yourusername/your-repo&quot;)<br><br>        licenses {<br>            license {<br>                name.set(&quot;The Apache Software License, Version 2.0&quot;)<br>                url.set(&quot;http://www.apache.org/licenses/LICENSE-2.0.txt&quot;)<br>            }<br>        }<br>        developers {<br>            developer {<br>                id.set(&quot;yourusername&quot;)<br>                name.set(&quot;Your Name&quot;)<br>                email.set(&quot;your.email@example.com&quot;)<br>            }<br>        }<br>        scm {<br>            connection.set(&quot;scm:git:git://github.com/yourusername/your-repo.git&quot;)<br>            developerConnection.set(&quot;scm:git:ssh://github.com/yourusername/your-repo.git&quot;)<br>            url.set(&quot;https://github.com/yourusername/your-repo&quot;)<br>        }<br>    }<br><br>    // 3. Target modern Sonatype Central Portal<br>    publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)<br><br>    // 4. Sign publications with GPG<br>    signAllPublications()<br>}</pre><h3>🔐 Step 2: Store Credentials Securely</h3><h3>1. Export Secret Key (Binary Format)</h3><p>Run this command in your terminal to create secring.gpg in your global Gradle folder:</p><pre>bash</pre><pre>gpg --export-secret-keys YOUR_KEY_ID &gt; ~/.gradle/secring.gpg</pre><h3>2. Add Secrets to ~/.gradle/gradle.properties</h3><p>Open your global properties file (nano ~/.gradle/gradle.properties) and add:</p><pre>properties</pre><pre># Sonatype Central User Token (From central.sonatype.com)</pre><pre>mavenCentralUsername=YOUR_SONATYPE_USER_TOKEN</pre><pre>mavenCentralPassword=YOUR_SONATYPE_PASSWORD_TOKEN</pre><pre># GPG Key Info</pre><pre>signing.keyId=YOUR_KEY_ID</pre><pre>signing.password=YOUR_GPG_PASSPHRASE</pre><pre>signing.secretKeyRingFile=/Users/yourusername/.gradle/secring.gpg</pre><h3>📦 Step 3: Run Publish Command</h3><p>Execute the publishing command from your project root:</p><pre>bash</pre><pre>./gradlew publishAndReleaseToMavenCentral</pre><p>This task compiles your .aar, generates source/javadoc jars, signs them, and uploads everything to Sonatype Central Portal automatically!</p><h3>🛠️ Common Issues &amp; Fixes (Troubleshooting Guide)</h3><p>Here are 3 real errors you might encounter while publishing and how to resolve them quickly:</p><h3>❌ Issue 1: gpg: keyserver send failed: No route to host</h3><ul><li><strong>Symptom</strong>: CLI fails to send your GPG public key to keyserver.ubuntu.com or keys.openpgp.org.</li><li><strong>Cause</strong>: Most ISPs and local firewalls block the default HKP port (11371).</li><li><strong>Solution</strong>: Bypass the CLI completely and upload via the Web UI:</li></ul><ol><li>Export your public key: gpg --armor --export YOUR_KEY_ID</li><li>Open <a href="https://keyserver.ubuntu.com/"><strong>keyserver.ubuntu.com</strong></a> in your browser.</li><li>Paste the ASCII text block into <strong>Submit a key</strong> and click Submit.</li></ol><h3>❌ Issue 2: Unable to read secret key from file: secring.gpg (it may not be a PGP secret key ring)</h3><ul><li><strong>Symptom</strong>: Gradle fails during signReleasePublication with signatory.keyId evaluation error.</li><li><strong>Cause</strong>: You exported the secret key using the --armor flag, creating an ASCII text file. Gradle strictly expects a binary keyring file.</li><li><strong>Solution</strong>: Re-export your secret key <strong>without</strong> --armor:</li><li>bash</li><li>gpg — export-secret-keys YOUR_KEY_ID &gt; ~/.gradle/secring.gpg</li></ul><h3>❌ Issue 3: Gradle Implicit Task Dependency Error (BundleAar vs signReleasePublication)</h3><ul><li><strong>Symptom</strong>: Build fails with:</li><li><em>Task ‘:signReleasePublication’ uses output of task ‘:bundleReleaseAar’ without declaring an explicit or implicit dependency.</em></li><li><strong>Cause</strong>: Newer Gradle versions enforce strict task validation when signing generated AAR files.</li><li><strong>Solution</strong>: Add an explicit task dependency at the bottom of your library module’s build.gradle.kts:</li><li>kotlin</li><li>// Fix Gradle task dependency validation for signing AAR</li><li>tasks.named(“signReleasePublication”) {</li><li>dependsOn(tasks.named(“bundleReleaseAar”))</li><li>}</li></ul><h3>✅ How to Verify Your Publication</h3><p>Once ./gradlew publishAndReleaseToMavenCentral succeeds, verify it:</p><ol><li><strong>Sonatype Dashboard (Immediate)</strong>: Log in to <a href="https://central.sonatype.com/">central.sonatype.com</a> and check <strong>Deployments</strong>. The status will progress from VALIDATING -&gt; PUBLISHING -&gt; PUBLISHED.</li><li><strong>Search Maven Central (15–20 minutes)</strong>: Search for your group ID or library name on <a href="https://central.sonatype.com/search">central.sonatype.com/search</a>.</li><li><strong>Test in Android App</strong>: Add mavenCentral() to your settings.gradle.kts and include your dependency:</li></ol><ul><li>kotlin</li><li>dependencies {</li><li>implementation(“io.github.yourusername:your-library-name:1.0.0”)</li><li>}</li></ul><p>Happy Coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38086c2474bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>