<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Josh Kasten</title>
    <description>The latest articles on Forem by Josh Kasten (@jkasten).</description>
    <link>https://forem.com/jkasten</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F617655%2Fb2c4b24d-71eb-445a-992e-f6bf3798df9b.png</url>
      <title>Forem: Josh Kasten</title>
      <link>https://forem.com/jkasten</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jkasten"/>
    <language>en</language>
    <item>
      <title>Upgrade Your Android Project from JCenter to Maven Central</title>
      <dc:creator>Josh Kasten</dc:creator>
      <pubDate>Tue, 23 Mar 2021 19:27:33 +0000</pubDate>
      <link>https://forem.com/onesignal/upgrade-your-android-project-from-jcenter-to-maven-central-2mcl</link>
      <guid>https://forem.com/onesignal/upgrade-your-android-project-from-jcenter-to-maven-central-2mcl</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v_vYh8ap--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://onesignal.com/blog/content/images/2021/03/android-developer-support.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_vYh8ap--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://onesignal.com/blog/content/images/2021/03/android-developer-support.jpg" alt="Upgrade Your Android Project from JCenter to Maven Central"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google's Android Studio defaults to the JCenter repository for non-Google artifacts. Unfortunately, JFrog, the maintainers of JCenter, &lt;a href="https://dev.to/jbaruch/into-the-sunset-on-may-1st-bintray-jcenter-gocenter-and-chartcenter-pkk-temp-slug-2941368"&gt;recently announced&lt;/a&gt; that they are soon sunsetting JCenter.&lt;/p&gt;

&lt;p&gt;Breaking down &lt;a href="https://dev.to/jbaruch/into-the-sunset-on-may-1st-bintray-jcenter-gocenter-and-chartcenter-pkk-temp-slug-2941368"&gt;JFrog's announcement&lt;/a&gt;, this means the following for Android developers for their app's dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;March 31st 2021 -&lt;/strong&gt; Libraries in JCenter will no longer be updated. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;February 1, 2022&lt;/strong&gt; - JCenter will be completely shut down.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All Android developers should switch off of JCenter in order to continue getting updates to libraries and SDKs that they use. OneSignal and many other libraries are already available on &lt;a href="https://mvnrepository.com/repos/central"&gt;Maven Central&lt;/a&gt;, so migrating is a safe and simple process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow the steps below to make the switch:&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Add Maven Central to your project to ensure OneSignal continues to get updated.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open your root &lt;code&gt;build.gradle&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Find lines that say &lt;code&gt;jcenter()&lt;/code&gt; and add &lt;code&gt;mavenCentral()&lt;/code&gt; before each of them &lt;em&gt;(Make sure to add &lt;code&gt;mavenCenteral()&lt;/code&gt; in both spots where &lt;code&gt;jcenter()&lt;/code&gt; is found.)&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After this change, your &lt;code&gt;build.gradle&lt;/code&gt; should look like this:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral() // New line
        jcenter()
       // NOTE: Keep any other entries you may have had here
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.2"
        //... no changes here
    }
}

allprojects {
    repositories {
        google()
        mavenCentral() // New line
        jcenter()
       // NOTE: Keep any other entries you may have had here
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ Sync Gradle by pressing "Sync Now" in Android Studio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Fully migrate off of JCenter.
&lt;/h2&gt;

&lt;p&gt;This section is optional until February 1, 2022 but we recommend following it today since &lt;a href="https://status.bintray.com/incidents/ctv4bdfz08bg"&gt;JCenter has been less reliable&lt;/a&gt; as it sunsets. The following steps will also allow you to discover any other dependencies you have on JCenter.&lt;/p&gt;

&lt;p&gt;You may have noticed that adding Maven Central before JCenter means Maven Central will be used by default, and JCenter will still be used as a fallback.&lt;/p&gt;

&lt;p&gt;If you attempt to remove &lt;code&gt;jcenter()&lt;/code&gt; completely today from your Android project, you may get the following error.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; Could not resolve all artifacts for configuration ':classpath'.
   &amp;gt; Could not find org.jetbrains.trove4j:trove4j:20160824.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
     Required by:
         project : &amp;gt; com.android.tools.build:gradle:4.1.2 &amp;gt; com.android.tools.build:builder:4.1.2 &amp;gt; com.android.tools:sdk-common:27.1.2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reason for this error is that the Android Core dependency still requires JCenter.&lt;/p&gt;

&lt;p&gt;Android Studio 4.1.2 and AGP (Android Gradle Plugin) still require a version of a dependency (trove4j) that is only on JCenter.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;a href="https://issuetracker.google.com/issues/109894262#comment7"&gt;This is solved in AGP 4.2.0&lt;/a&gt;, but this is still in beta and requires Android Studio 4.2 beta or newer.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To fix the missing &lt;code&gt;trove4j&lt;/code&gt; error, you can force an upgrade to a newer version that is available on Maven Central by adding the following to the bottom of your root &lt;code&gt;build.gradle&lt;/code&gt;.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Temporary workaround for missing trove4j when removing jcenter() until you can upgrade to "com.android.tools.build:gradle:4.2.0"
buildscript {
    configurations.all {
        resolutionStrategy {
            eachDependency {
                // https://issuetracker.google.com/issues/109894262#comment9
                if (requested.group == "org.jetbrains.trove4j" &amp;amp;&amp;amp; requested.name == "trove4j" &amp;amp;&amp;amp; requested.version == "20160824") {
                    useTarget("org.jetbrains.intellij.deps:trove4j:1.0.20181211")
                }
            }
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;a href="https://issuetracker.google.com/issues/109894262#comment11"&gt;Source&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  If you encounter other "could not resolve" errors:
&lt;/h3&gt;

&lt;p&gt;You may find that not all libraries or SDKs in your project are on Maven Central.&lt;/p&gt;

&lt;p&gt;If you still see build errors after removing &lt;code&gt;jcenter()&lt;/code&gt;, please check your build log and contact the vendors of those dependencies on to get guidance on their migration strategy. Keep in mind that JCenter will no longer work after Feb 1, 2022.&lt;/p&gt;

&lt;h1&gt;
  
  
  OneSignal Resources &amp;amp; Support
&lt;/h1&gt;

&lt;p&gt;To continue getting OneSignal Android SDK updates after March 31, 2021, make sure to add Maven Central to your project by following the above guide. &lt;a href="https://search.maven.org/artifact/com.onesignal/OneSignal"&gt;OneSignal is already hosted on Maven Central&lt;/a&gt;, including the latest OneSignal SDK and all previous versions.&lt;/p&gt;

&lt;p&gt;If you have any OneSignal issues with the upgrade you can contact &lt;a href="https://app.onesignal.com/"&gt;OneSignal support&lt;/a&gt;&lt;a href="https://app.onesignal.com/"&gt;via the dashboard&lt;/a&gt;, or &lt;a href="https://github.com/OneSignal/OneSignal-Android-SDK/issues/1293"&gt;post your question on this GitHub issue&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>developer</category>
      <category>android</category>
      <category>news</category>
    </item>
  </channel>
</rss>
