title: Cannot access class from aar
body: <p>I have been stuck for the past 2 days now. I want to import my own aar in one of my sample apps and then use it. I can not access the classes inside the aar and get a <code>java.lang.NoClassDefFoundError</code> error.</p>
  
  <p>Now since this is a common problem, I have tried the below so far,after reading each and every related question:</p>
  
  <p>1) Importing the aar by going to : <code>File -&gt; New-&gt; New Module -&gt; Import .JAR/.AAR</code>
  and then adding <code>compile project(':Name-Of-Your-Project')</code> to the gradle.</p>
  
  <p>2) Using the maven plugin and pushing the aar to the local maven repo by using gradle install and then reffering to the local repo aar in my gradle.</p>
  
  <pre><code>compile ('com.rsa.mobile.sdk.android:authsdk:3.6.0-SNAPSHOT:debug@aar'){
        //  transitive=true
      }
  </code></pre>
  
  <p>Note: If I uncomment the transitive=true, i get the below exception while installing the application:</p>
  
  <pre><code>UNEXPECTED TOP-LEVEL EXCEPTION:
      com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
  </code></pre>
  
  <p>3) Rebuilding and cleaning the project as suggested in a lot of answers.</p>
  
  <p>4) The only one thing which didnt work out was by putting the aar in a directory and then reffering it like <code>compile(name:'Name-Of-Your-Project', ext:'aar')</code> , after adding </p>
  
  <pre><code>flatDir {
        dirs 'libs'
          }
  </code></pre>
  
  <p>to the repo.
  I dont think the 4th point should matter as the correct way now is as mentioned in point 1 above, but just wanted to put it out.</p>
  
  <p>Can someone please help. It looks like a trivial issue but I have already wasted around 2 days.</p>