title: how to handle dependency cycle dagger 2
body: <p>I have two classes <code>PdfTicketStorage</code> and <code>OfflineHelper</code> they both depend on each other.</p>
  <p>OfflineHelper class requires PdfTicketStorage to send data to firebase</p>
  <pre><code>class OfflineHelper @Inject constructor(
      private val app: App,
      private val settings: Settings,
      private val pdfTicketStorage: PdfTicketStorage,
  ) {
         private fun postPrintedTicket(offlineData: OfflineData) {
        //SENDS DATA TO FIREBASE
          val offlinePrintedTicketInfo = gson.fromJson(offlineData.requestInfoJson, OfflinePrintedTicketInfo::class.java)
          pdfTicketStorage.store(offlinePrintedTicketInfo.pdfTicketFilePath, offlinePrintedTicketInfo.pdfTicketContent)
      }
  
      fun saveOfflineDataWithPdf() {
        //save data to database
      }
  }
  </code></pre>
  <p>PdfTicketStorage requires offlineHelper to save data in the database</p>
  <pre><code>public class PdfTicketStorage {
  
      private final String cloudStorageBucket;
      private final OfflineHelper offlineHelper;
  
      public PdfTicketStorage(String cloudStorageBucket, OfflineHelper offlineHelper) {
          this.cloudStorageBucket = cloudStorageBucket;
          this.offlineHelper = offlineHelper;
      }
  
       public Single&lt;String&gt;  storeTest(final String filePath, final byte[] fileContents, final String fuelOrderId) {
              offlineHelper.saveOfflineDataWithPdf();
              return Single.just(&quot;&quot;);
        
      }
  }
  </code></pre>
  <p>As both are interdependent how can resolve the dependency cycle</p>
  <p>error i get</p>
  <pre><code>[Dagger/DependencyCycle] Found a dependency cycle:
  public interface AppComponent {
         ^
        com.xx.xxx.clean.offline.OfflineHelper is injected at
            com.xx.xxx.injection.modules.ServiceModule.providePdfTicketStorage(…, offlineHelper)
        com.xx.xxx.printing.storage.PdfTicketStorage is injected at
            com.xx.xxx.clean.offline.OfflineHelper(…, pdfTicketStorage, …)
        com.xx.xxx.clean.offline.OfflineHelper is injected at
            com.xx.xxx.activities.MainActivity.offlineHelper
        com.xx.xxx.activities.MainActivity is injected at
            com.xxx.xx.injection.components.ActivityComponent.inject(com.xx.xxx.activities.MainActivity) [com.xx.xxx.injection.components.AppComponent → com.xx.xxx.injection.components.ActivityComponent]
  </code></pre>
  <p>ServiceModule</p>
  <pre><code>  @Provides @PerApp
      public PdfTicketStorage providePdfTicketStorage(App app, OfflineHelper offlineHelper) {
          return new PdfTicketStorage(app.getString(R.string.cloud_storage_bucket), offlineHelper);
      }
  </code></pre>
  <p>Could you suggest any alternatives to fix this please</p>
  <p>thanks
  R</p>