glide icon indicating copy to clipboard operation
glide copied to clipboard

cannot resolve symbol 'GlideApp' (GlideApp was not generated)

Open sonzerolee opened this issue 9 years ago • 45 comments

I'm using 4.0.0-RC0, I added it by Gradle:

repositories {  mavenCentral() // jcenter() works as well because it pulls from Maven Central } dependencies {  compile 'com.android.support:appcompat-v7:25.3.1'  compile 'com.github.bumptech.glide:glide:4.0.0-RC0'  compile 'com.android.support:support-v4:25.3.1'  annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0' }

I followed the here: https://github.com/bumptech/glide/tree/master/samples/svg/src/main/java/com/bumptech/glide/samples/svg But when i try load SVG file to ImageView, i get error message: cannot resolve symbol 'GlideApp' I think GlideApp class was not generated. My source:

package com.example.quangson.glidesvg; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; import android.graphics.drawable.PictureDrawable; import android.net.Uri; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.RequestBuilder; import com.caverock.androidsvg.SVGImageView; import com.example.quangson.glidesvg.glide.SvgSoftwareLayerSetter; public class MainActivity extends AppCompatActivity {  private static final String TAG = "SVGActivity";  private ImageView imageViewRes;  private ImageView imageViewNet;  private RequestBuilder requestBuilder;  @Override  protected void onCreate(Bundle savedInstanceState) {   super.onCreate(savedInstanceState);   setContentView(R.layout.activity_main);   imageViewRes = (ImageView) findViewById(R.id.svg_image_view1);   imageViewNet = (ImageView) findViewById(R.id.svg_image_view2);   requestBuilder = GlideApp.with(this)     .as(PictureDrawable.class)     .placeholder(R.drawable.image_loading)     .error(R.drawable.image_error)     .transition(withCrossFade())     .listener(new SvgSoftwareLayerSetter());   Uri uri = Uri.parse("http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg");   requestBuilder.load(uri).into(imageViewNet);  } }

How to generate GlideApp class? Please help

sonzerolee avatar May 19 '17 10:05 sonzerolee

Any solution ? The same happens to me, adds both glide and annotationProcessor compiler glide

nexodev avatar May 19 '17 14:05 nexodev

Please comment on your original issue, don't open new identical issues.

Let me know if following the instructions in #1939 doesn't help.

Edit: documentation was updated with Kotlin setup instructions: http://bumptech.github.io/glide/doc/generatedapi.html#kotlin

sjudd avatar May 20 '17 00:05 sjudd

Just use android studio -> menu ->build ->Make Project ,then the GlideApp will generate in the build/generated/source.....

But I have another problem , I can't use the GlideApp in the kotlin class, when I build the app, gradle will 'KotlinExt.kt: Unresolved reference: GlideApp'

niray avatar May 23 '17 01:05 niray

I have the same issue trying to use GlideApp from kotlin.

tmm1 avatar Jun 01 '17 04:06 tmm1

I am having same issue in Java also.

moinkhan-in avatar Jun 21 '17 09:06 moinkhan-in

@niray @tmm1 please file a new issue for kotlin. I'm not especially familiar with the language so your largely on your own. If you do find a solution I'd definitely welcome a contribution.

@msquare097 See the duplicate issue #1939

sjudd avatar Jun 21 '17 14:06 sjudd

@sjudd, there is no issue in your library. I don't know what was the bug, i think there is a problem with android studio.

If there is error some where else in project, then it will point out your bug, while bug is not in your library. And when I solved that bug it will compile and without any problem.

And to get the confident i repeat this cycle 3 times, and got the same case.

In short when there is error somewhere else in project, it will just point out error in your lib, when we solved that error, then it will run properly.

May be there can be issue with code generation.

moinkhan-in avatar Jun 24 '17 05:06 moinkhan-in

It's just how javac works, at work we have multiple annotation processors and if we miss an import, or have a typo in variable name, it lists all the generated classes as unresolved symbol from all the different processors (e.g. Dagger 2). The real error message is hidden within tons of unrelated messages, so we need to scroll through all of them to find the problem.

TWiStErRob avatar Jun 24 '17 12:06 TWiStErRob

@niray It's not working man !

miketrinh1995 avatar Jul 17 '17 12:07 miketrinh1995

http://bumptech.github.io/glide/ In glide 4 there is another options

timkabot avatar Jul 22 '17 08:07 timkabot

I had the same issue and I found the solution right here on step 2: http://bumptech.github.io/glide/doc/generatedapi.html

You must create a GlideModule and rebuild:

package com.example.myapp;
   
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
   
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}

PedroOkawa avatar Aug 03 '17 13:08 PedroOkawa

Duplicate of #1939

sjudd avatar Aug 15 '17 23:08 sjudd

+1

followthemoney1 avatar Oct 04 '17 11:10 followthemoney1

+2: I got the same isssue.

lbx2015 avatar Oct 25 '17 10:10 lbx2015

I solved by click Build->ReBuild Project. I don't know what to say this issue follow me several days. Could you add these step in the document please, for we all use android studio 2.3.3 for the moment. It worth to do this step description.

lbx2015 avatar Oct 25 '17 11:10 lbx2015

File > Invalidate Caches / Restart

nixmaldonado avatar Nov 10 '17 17:11 nixmaldonado

Rebuild project. Thats it..

aamernabi avatar Dec 04 '17 18:12 aamernabi

guys facing the same issue GlideApp variable remains unresolved and when i am using Glide.load()... i am not able to set place holder ..Any of the above mentioned fixes are not working for me.

Amit030 avatar Dec 20 '17 07:12 Amit030

The generated API is not a requirement, it's just a little bit nicer syntax, see http://bumptech.github.io/glide/doc/options.html and http://bumptech.github.io/glide/doc/migrating.html.

That said, I haven't seen a case where the fixes suggested here and in the documentation don't work. If you've found a case, please attach a sample app that reproduces the problem.

sjudd avatar Dec 20 '17 14:12 sjudd

For those experiencing this issue, also make sure annotationProcessor 'com.github.bumptech.glide:compiler:4.X.X is added to module level build.gradle

wilburx9 avatar Dec 28 '17 14:12 wilburx9