bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.61k stars 6.12k forks source link

How to use GlideAppModule with plugin `com.neenbedankt.gradle.plugins:android-apt` #2209

Closed sinhpn92 closed 7 years ago

sinhpn92 commented 7 years ago

My project using com.neenbedankt.gradle.plugins:android-apt Plugins. When I import Glide version 4.0.0, It was not generated GlideApp. How can generate GlideApp with com.neenbedankt.gradle.plugins:android-apt Plugin? Thanks

PaulWoitaschek commented 7 years ago

Replace annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

with

apt 'com.github.bumptech.glide:compiler:4.0.0'

But imo you should just drop the androd-apt plugin and just use the built in annotationProcessor.

sinhpn92 commented 7 years ago

My project using androidannotations. So if i: Replace annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

with

apt 'com.github.bumptech.glide:compiler:4.0.0'

my old annotation is not works.

sinhpn92 commented 7 years ago

My project gradle:

Plugins:

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'`
.
.
.
    compile files('libs/simple.facebook-2.2.jar')
    compile files('khandroid-httpclient-4.2.3.jar')
    compile project(':imageViewLibrary')
    compile files('libs/ormlite-android-4.48.jar')
    compile files('libs/ormlite-core-4.48.jar')
    compile files('libs/khandroid-httpclient-4.2.3.jar')
    compile project(':libfont')
     compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:answers:1.3.10@aar') {
        transitive = true;
    }
    compile project(':AnimationLib')
    compile files('libs/jsoup-1.9.2.jar')
    compile files('libs/universal-image-loader-1.9.5.jar')
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile "com.android.support:appcompat-v7:${supportVer}"
    compile "com.android.support:support-v4:${supportVer}"
    compile "com.android.support:recyclerview-v7:${supportVer}"
    compile "com.android.support:cardview-v7:${supportVer}"
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.3.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.google.api-client:google-api-client:1.20.0'
    compile 'com.google.api-client:google-api-client-android:1.20.0'
    compile 'com.google.api-client:google-api-client-gson:1.20.0'
    compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0'
    compile 'org.apmem.tools:layouts:1.9@aar'
    compile 'org.piwik.sdk:piwik-sdk:0.0.3'
    compile 'io.branch.sdk.android:library:2.+'
    compile 'me.grantland:autofittextview:0.2.+'
    compile 'com.intuit.sdp:sdp-android:1.0.3'
    compile 'com.daimajia.swipelayout:library:1.2.0@aar'
    compile 'com.github.Kennyc1012:BottomSheet:2.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'me.relex:circleindicator:1.2.1@aar'
    compile 'com.google.firebase:firebase-core:9.6.1'
    compile 'com.parse.bolts:bolts-android:1.+'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
    compile files('libs/systembartint-1.0.4.jar')
    compile 'pl.bclogic:pulsator4droid:1.0.3'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
    compile 'com.andkulikov:transitionseverywhere:1.7.0'
    compile 'com.fmsirvent:parallaxeverywhere:1.0.4'
    compile 'com.wang.avi:library:2.1.3'
    compile 'com.buddy:androidsdk:+'
    compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.google.android.gms:play-services-gcm:10.2.0'
    compile "com.google.android.gms:play-services-location:10.2.0"
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'com.facebook.android:notifications:1.+'
PaulWoitaschek commented 7 years ago

There is no glide at all.

sinhpn92 commented 7 years ago

@PaulWoitaschek oh I'm sure that i did add Glide: compile 'com.github.bumptech.glide:glide:4.0.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

PaulWoitaschek commented 7 years ago

And what happens if you replace annotationProcessor with apt?

sinhpn92 commented 7 years ago

@PaulWoitaschek : When use apt instead of annotationProcessor: I found that when i add @GlideModule into MyAppImageModule like this:

@GlideModule
public class MyAppImageModule extends AppGlideModule{
}

My project has error with current annotation like @EActivity, @EFragment, @Pref,....

if i don't use @GlideModule, my project works fine, but GlideApp was not generated.

PaulWoitaschek commented 7 years ago

What kind of errors? Post them. Also try to use a recent version of the app plugin.

TWiStErRob commented 7 years ago

@sinhpn92 careful with apt errors. Annotation processing does rounds, and error messages may show up that are not relevant. Make sure you read ALL error output to find the one that's causing the failure.

sinhpn92 commented 7 years ago

@PaulWoitaschek @TWiStErRob I was founding, but this error only showing when i add @GlideModule annotation in class MyAppImageModule. If i don't add @GlideModule, project build ok. THis my message when build error:

Information:Gradle tasks [:app:assembleDevelopDebug]
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for publishDebug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for publishRelease as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for developDebug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for developRelease as it may be conflicting with the internal version provided by Android.
Warning:string 'com_facebook_loginview_log_in_button_continue_f1gender' has no default translation.
Warning:string 'com_facebook_loginview_log_in_button_continue_m2gender' has no default translation.
Warning:string 'com_facebook_loginview_log_out_action_f1gender' has no default translation.
Warning:string 'com_facebook_loginview_log_out_action_m2gender' has no default translation.
Warning:string 'com_facebook_loginview_log_out_button_f1gender' has no default translation.
Warning:string 'com_facebook_loginview_log_out_button_m2gender' has no default translation.
Warning:string 'com_facebook_loginview_logged_in_as_f1gender' has no default translation.
Warning:string 'com_facebook_loginview_logged_in_as_m2gender' has no default translation.
Warning:string 'com_facebook_loginview_logged_in_using_facebook_f1gender' has no default translation.
Warning:string 'com_facebook_loginview_logged_in_using_facebook_m2gender' has no default translation.
Warning:string 'com_facebook_send_button_text_f1gender' has no default translation.
Warning:string 'com_facebook_send_button_text_m2gender' has no default translation.
Warning:string 'com_facebook_share_button_text_f1gender' has no default translation.
Warning:string 'com_facebook_share_button_text_m2gender' has no default translation.
Warning:string 'com_facebook_smart_login_confirmation_cancel_f1gender' has no default translation.
Warning:string 'com_facebook_smart_login_confirmation_cancel_m2gender' has no default translation.
Warning:string 'com_facebook_smart_login_confirmation_continue_as_f1gender' has no default translation.
Warning:string 'com_facebook_smart_login_confirmation_continue_as_m2gender' has no default translation.
Warning:string 'com_facebook_smart_login_confirmation_title_f1gender' has no default translation.
Warning:string 'com_facebook_smart_login_confirmation_title_m2gender' has no default translation.
Warning:string 'com_facebook_tooltip_default_f1gender' has no default translation.
Warning:string 'com_facebook_tooltip_default_m2gender' has no default translation.

C:\SystemData\...\CommentActivity.java
Error:(37, 25) error: cannot find symbol class FollowActivity_
.
.
//All my annotation like @EActivity, @EFragment, @Pref error
.
Warning:A malformed <meta-data> has been found in the manifest with name com.google.firebase.messaging.default_notification_icon
Warning:A malformed <meta-data> has been found in the manifest with name com.google.firebase.messaging.default_notification_color
Error:Execution failed for task ':app:compileDevelopDebugJavaWithJavac'.
> java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.toList()Lcom/google/common/collect/ImmutableList;
Information:BUILD FAILED
Information:Total time: 8.034 secs
Information:101 errors
Information:28 warnings
Information:See complete output in console
sinhpn92 commented 7 years ago

error: cannot find symbol class ... This error with all class has generated by androidannotations.

Module Class:

@GlideModule
public class MyAppImageModule extends AppGlideModule{

}

Tried: First way, if i import glide by:

compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.github.bumptech.glide:annotations:4.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

-> GlideApp class is not generate.

Second way, if i import glide by:

compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.github.bumptech.glide:annotations:4.0.0'
apt 'com.github.bumptech.glide:compiler:4.0.0'

-> All class was generated by androidannotation cannot find symbol error. In this way, i comment @GlideModule then project build success.

TWiStErRob commented 7 years ago

Information:101 errors

That's the problem probably, you're simply not seeing the error.

Do the following:

  1. remove any traces of com.neenbedankt.gradle.plugins:android-apt
  2. change ALL apt to annotationProcessor
  3. add afterEvaluate { tasks.withType(JavaCompile) { options.compilerArgs += [ '-Xmaxerrs', '10000' ] } } to your build.gradle
  4. read all errors
sinhpn92 commented 7 years ago

@TWiStErRob thanks so much. I have remove android-apt and change to annotationProcessor. My project built success and GlideApp was generated.