<p dir="auto"><strong>Glide Version</strong>:3.8.0</p>

<p dir="auto"><strong>Integration libraries</strong>: no</p>

<p dir="auto"><strong>Device/Android Version</strong>: all version</p>

<p dir="auto"><strong>Issue details / Repro steps / Use case background</strong>:<br>
Image crops the wrong ratio when it first time was laoded. It was solved after I refresh the data and reloads the image. I found it may cause by the placeholde , if I change the placeholde to color resource or appropriate image size (such as 320x160 in 720 devices) then  it woks fine. I want to use the unique placeholder image for every resolution, so I use centerCrop in ImageView. How to make it show the right ratio in first time ?<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/10027821/16905346/4114abd4-4cd7-11e6-8a47-46be6efab5f6.png"><img src="https://cloud.githubusercontent.com/assets/10027821/16905346/4114abd4-4cd7-11e6-8a47-46be6efab5f6.png" alt="image" style="max-width: 100%;"></a></p>

<p dir="auto"><strong>Glide load line / <code class="notranslate">GlideModule</code> (if any) / list Adapter code (if any)</strong>:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Glide.with(activity)
        .load(new GlideUrl(url, mHeader))
        .error(error)
        .placeholder(placeHolder)
        .into(target)"><pre class="notranslate"><span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-s1">activity</span>)
        .<span class="pl-en">load</span>(<span class="pl-k">new</span> <span class="pl-smi">GlideUrl</span>(<span class="pl-s1">url</span>, <span class="pl-s1">mHeader</span>))
        .<span class="pl-en">error</span>(<span class="pl-s1">error</span>)
        .<span class="pl-en">placeholder</span>(<span class="pl-s1">placeHolder</span>)
        .<span class="pl-en">into</span>(<span class="pl-s1">target</span>)</pre></div>

<p dir="auto"><strong>Layout XML</strong>:</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;LinearLayout
        android:layout_width=&quot;match_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:orientation=&quot;horizontal&quot;
        android:paddingLeft=&quot;15dip&quot;
        android:paddingRight=&quot;15dip&quot;&gt;

        &lt;LinearLayout
            android:id=&quot;@+id/fragment_main_feed_header_theme1_ll&quot;
            android:layout_width=&quot;0dip&quot;
            android:layout_height=&quot;wrap_content&quot;
            android:layout_marginBottom=&quot;10dp&quot;
            android:layout_marginRight=&quot;10dp&quot;
            android:layout_weight=&quot;1&quot;
            android:orientation=&quot;vertical&quot;&gt;

            &lt;ImageView
                android:id=&quot;@+id/fragment_main_feed_header_theme1_iv&quot;
                android:layout_width=&quot;match_parent&quot;
                android:layout_height=&quot;80dp&quot;
                android:layout_weight=&quot;1&quot;
                android:adjustViewBounds=&quot;true&quot;
                android:scaleType=&quot;centerCrop&quot;
                android:src=&quot;@drawable/picture_loading_placeholder_max&quot;/&gt;

            &lt;TextView
                android:id=&quot;@+id/fragment_main_feed_header_theme1_tv&quot;
                android:layout_width=&quot;match_parent&quot;
                android:layout_height=&quot;wrap_content&quot;
                android:layout_marginTop=&quot;8dp&quot;
                android:ellipsize=&quot;end&quot;
                android:gravity=&quot;center&quot;
                android:includeFontPadding=&quot;false&quot;
                android:singleLine=&quot;true&quot;
                android:textColor=&quot;@color/hei_333333&quot;
                android:textSize=&quot;12sp&quot;/&gt;
        &lt;/LinearLayout&gt;


        &lt;LinearLayout
            android:id=&quot;@+id/fragment_main_feed_header_theme2_ll&quot;
            android:layout_width=&quot;0dip&quot;
            android:layout_height=&quot;wrap_content&quot;
            android:layout_weight=&quot;1&quot;
            android:orientation=&quot;vertical&quot;&gt;

            &lt;ImageView
                android:id=&quot;@+id/fragment_main_feed_header_theme2_iv&quot;
                android:layout_width=&quot;match_parent&quot;
                android:layout_height=&quot;80dp&quot;
                android:layout_weight=&quot;1&quot;
                android:adjustViewBounds=&quot;true&quot;
                android:scaleType=&quot;centerCrop&quot;
                android:src=&quot;@drawable/picture_loading_placeholder_max&quot;/&gt;

            &lt;TextView
                android:id=&quot;@+id/fragment_main_feed_header_theme2_tv&quot;
                android:layout_width=&quot;match_parent&quot;
                android:layout_height=&quot;wrap_content&quot;
                android:layout_marginTop=&quot;8dp&quot;
                android:ellipsize=&quot;end&quot;
                android:gravity=&quot;center&quot;
                android:includeFontPadding=&quot;false&quot;
                android:singleLine=&quot;true&quot;
                android:textColor=&quot;@color/hei_333333&quot;
                android:textSize=&quot;12sp&quot;/&gt;
        &lt;/LinearLayout&gt;
    &lt;/LinearLayout&gt;"><pre class="notranslate">&lt;<span class="pl-ent">LinearLayout</span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>match_parent<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>wrap_content<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">orientation</span>=<span class="pl-s"><span class="pl-pds">"</span>horizontal<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">paddingLeft</span>=<span class="pl-s"><span class="pl-pds">"</span>15dip<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">paddingRight</span>=<span class="pl-s"><span class="pl-pds">"</span>15dip<span class="pl-pds">"</span></span>&gt;

        &lt;<span class="pl-ent">LinearLayout</span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>@+id/fragment_main_feed_header_theme1_ll<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>0dip<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>wrap_content<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_marginBottom</span>=<span class="pl-s"><span class="pl-pds">"</span>10dp<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_marginRight</span>=<span class="pl-s"><span class="pl-pds">"</span>10dp<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_weight</span>=<span class="pl-s"><span class="pl-pds">"</span>1<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">orientation</span>=<span class="pl-s"><span class="pl-pds">"</span>vertical<span class="pl-pds">"</span></span>&gt;

            &lt;<span class="pl-ent">ImageView</span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>@+id/fragment_main_feed_header_theme1_iv<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>match_parent<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>80dp<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_weight</span>=<span class="pl-s"><span class="pl-pds">"</span>1<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">adjustViewBounds</span>=<span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">scaleType</span>=<span class="pl-s"><span class="pl-pds">"</span>centerCrop<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">src</span>=<span class="pl-s"><span class="pl-pds">"</span>@drawable/picture_loading_placeholder_max<span class="pl-pds">"</span></span>/&gt;

            &lt;<span class="pl-ent">TextView</span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>@+id/fragment_main_feed_header_theme1_tv<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>match_parent<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>wrap_content<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_marginTop</span>=<span class="pl-s"><span class="pl-pds">"</span>8dp<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">ellipsize</span>=<span class="pl-s"><span class="pl-pds">"</span>end<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">gravity</span>=<span class="pl-s"><span class="pl-pds">"</span>center<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">includeFontPadding</span>=<span class="pl-s"><span class="pl-pds">"</span>false<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">singleLine</span>=<span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">textColor</span>=<span class="pl-s"><span class="pl-pds">"</span>@color/hei_333333<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">textSize</span>=<span class="pl-s"><span class="pl-pds">"</span>12sp<span class="pl-pds">"</span></span>/&gt;
        &lt;/<span class="pl-ent">LinearLayout</span>&gt;


        &lt;<span class="pl-ent">LinearLayout</span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>@+id/fragment_main_feed_header_theme2_ll<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>0dip<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>wrap_content<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_weight</span>=<span class="pl-s"><span class="pl-pds">"</span>1<span class="pl-pds">"</span></span>
            <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">orientation</span>=<span class="pl-s"><span class="pl-pds">"</span>vertical<span class="pl-pds">"</span></span>&gt;

            &lt;<span class="pl-ent">ImageView</span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>@+id/fragment_main_feed_header_theme2_iv<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>match_parent<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>80dp<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_weight</span>=<span class="pl-s"><span class="pl-pds">"</span>1<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">adjustViewBounds</span>=<span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">scaleType</span>=<span class="pl-s"><span class="pl-pds">"</span>centerCrop<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">src</span>=<span class="pl-s"><span class="pl-pds">"</span>@drawable/picture_loading_placeholder_max<span class="pl-pds">"</span></span>/&gt;

            &lt;<span class="pl-ent">TextView</span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">id</span>=<span class="pl-s"><span class="pl-pds">"</span>@+id/fragment_main_feed_header_theme2_tv<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>match_parent<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>wrap_content<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_marginTop</span>=<span class="pl-s"><span class="pl-pds">"</span>8dp<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">ellipsize</span>=<span class="pl-s"><span class="pl-pds">"</span>end<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">gravity</span>=<span class="pl-s"><span class="pl-pds">"</span>center<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">includeFontPadding</span>=<span class="pl-s"><span class="pl-pds">"</span>false<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">singleLine</span>=<span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">textColor</span>=<span class="pl-s"><span class="pl-pds">"</span>@color/hei_333333<span class="pl-pds">"</span></span>
                <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">textSize</span>=<span class="pl-s"><span class="pl-pds">"</span>12sp<span class="pl-pds">"</span></span>/&gt;
        &lt;/<span class="pl-ent">LinearLayout</span>&gt;
    &lt;/<span class="pl-ent">LinearLayout</span>&gt;</pre></div>

<p dir="auto"><strong>Stack trace / LogCat</strong>:</p>
<div class="highlight highlight-source-ruby notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="paste stack trace and/or log here"><pre class="notranslate"><span class="pl-en">paste</span> <span class="pl-en">stack</span> <span class="pl-en">trace</span> <span class="pl-k">and</span>/<span class="pl-en">or</span> <span class="pl-en">log</span> <span class="pl-en">here</span></pre></div>
<p dir="auto"><strong>Glide Version</strong>: 4.1.1</p>

<p dir="auto"><strong>Issue details</strong>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3355843/30424814-acbba69a-9979-11e7-8cfc-3a620c8718bc.png"><img width="332" alt="screen shot 2017-09-14 at 18 19 50" src="https://user-images.githubusercontent.com/3355843/30424814-acbba69a-9979-11e7-8cfc-3a620c8718bc.png" style="max-width: 100%;"></a><br>
I create a new project named app, and then create a new module named mylibrary. I include glide4 dependency both in my app module and library module followed by <a href="http://bumptech.github.io/glide/doc/download-setup.html#download" rel="nofollow">doc</a><br>
<code class="notranslate">app/build.gradle</code>code:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="apply plugin: 'com.android.application'

android {
    ...
}

dependencies {
    compile project(&quot;:mylibrary&quot;)
    compile 'com.github.bumptech.glide:glide:4.1.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
}
"><pre class="notranslate"><span class="pl-smi">apply</span> <span class="pl-s1">plugin</span>: <span class="pl-s">'com.android.application'</span>

<span class="pl-s1">android</span> {
    ...
}

<span class="pl-s1">dependencies</span> {
    <span class="pl-smi">compile</span> <span class="pl-s1">project</span>(<span class="pl-s">":mylibrary"</span>)
    <span class="pl-s1">compile</span> <span class="pl-s">'com.github.bumptech.glide:glide:4.1.1'</span>
    <span class="pl-s1">annotationProcessor</span> <span class="pl-s">'com.github.bumptech.glide:compiler:4.1.1'</span>
}</pre></div>
<p dir="auto"><code class="notranslate">mylibrary/build.gradle</code> code:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="apply plugin: 'com.android.library'

android {
    ...
}

dependencies {
    compile 'com.github.bumptech.glide:glide:4.1.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
}"><pre class="notranslate"><span class="pl-smi">apply</span> <span class="pl-s1">plugin</span>: <span class="pl-s">'com.android.library'</span>

<span class="pl-s1">android</span> {
    ...
}

<span class="pl-s1">dependencies</span> {
    <span class="pl-s1">compile</span> <span class="pl-s">'com.github.bumptech.glide:glide:4.1.1'</span>
    <span class="pl-s1">annotationProcessor</span> <span class="pl-s">'com.github.bumptech.glide:compiler:4.1.1'</span>
}</pre></div>
<p dir="auto">Then I create classes extends AppGlideModule both in app module and library module in order to use GlideApp (Glide generated API) in these two modules.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package com.myapp.app;

@GlideModule
public class MyAppModule extends AppGlideModule {
}"><pre class="notranslate"><span class="pl-k">package</span> <span class="pl-s1">com</span>.<span class="pl-s1">myapp</span>.<span class="pl-s1">app</span>;

<span class="pl-c1">@</span><span class="pl-c1">GlideModule</span>
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">MyAppModule</span> <span class="pl-k">extends</span> <span class="pl-smi">AppGlideModule</span> {
}</pre></div>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package com.myapp.mylibrary;

@GlideModule
public final class MyLibraryModule extends AppGlideModule {
}"><pre class="notranslate"><span class="pl-k">package</span> <span class="pl-s1">com</span>.<span class="pl-s1">myapp</span>.<span class="pl-s1">mylibrary</span>;

<span class="pl-c1">@</span><span class="pl-c1">GlideModule</span>
<span class="pl-k">public</span> <span class="pl-k">final</span> <span class="pl-k">class</span> <span class="pl-smi">MyLibraryModule</span> <span class="pl-k">extends</span> <span class="pl-smi">AppGlideModule</span> {
}</pre></div>
<p dir="auto">But after running the demo, crash occurs when I call <code class="notranslate">GlideApp.with(this)</code> in <code class="notranslate">MainActivity</code> belongs to app module.<br>
crash logcat:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.ClassCastException: com.myapp.mylibrary.GlideRequests cannot be cast to com.myapp.app.GlideRequests
    at com.laoyouzhibo.a.GlideApp.with(GlideApp.java:87)"><pre class="notranslate"><code class="notranslate">E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.ClassCastException: com.myapp.mylibrary.GlideRequests cannot be cast to com.myapp.app.GlideRequests
    at com.laoyouzhibo.a.GlideApp.with(GlideApp.java:87)
</code></pre></div>
<p dir="auto">I found <code class="notranslate">GeneratedAppGlideModuleImpl</code> and <code class="notranslate">GeneratedRequestManagerFactory</code> are duplicated inside app module and library module. IDE reminds me <code class="notranslate">duplicate class found in the file.</code><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3355843/30427646-1bd9fca8-9983-11e7-932a-606d8928a7f4.png"><img width="374" alt="screen shot 2017-09-14 at 18 25 35" src="https://user-images.githubusercontent.com/3355843/30427646-1bd9fca8-9983-11e7-932a-606d8928a7f4.png" style="max-width: 100%;"></a></p>
<p dir="auto">If I make <code class="notranslate">MyLibraryModule</code> extend <code class="notranslate">LibraryGlideModule</code>, I cannot find GlideApp in my library module.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@GlideModule
public final class MyLibraryModule extends LibraryGlideModule {
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">GlideModule</span>
<span class="pl-k">public</span> <span class="pl-k">final</span> <span class="pl-k">class</span> <span class="pl-smi">MyLibraryModule</span> <span class="pl-k">extends</span> <span class="pl-smi">LibraryGlideModule</span> {
}</pre></div>
<p dir="auto">This is a simple demonstration for my situation. My application module and a couple of library modules depend on glide.</p>