HarlonWang/AVLoadingIndicatorView · warning

Didn't find your class , check the name again !

Error message

Didn't find your class , check the name again !

What it means

This is a log-catch (not an exception) emitted by AVLoadingIndicatorView.setIndicator(String name) when reflection fails to load an indicator class. The library builds a fully-qualified class name from the given indicator name and calls Class.forName; if no class matches, ClassNotFoundException is caught and this message is logged, leaving the previous indicator in place. It means the requested loading-indicator name does not correspond to any class in the com.wang.avi.indicators package.

Solutions

  1. Use the exact class simple name of an indicator in com.wang.avi.indicators, e.g. setIndicator("BallPulseIndicator") or a valid name like "BallGridPulse", "BallClipRotate", etc.
  2. Check the version of the library you depend on and confirm the indicator exists in com.wang.avi.indicators for that version (names changed across releases).
  3. Prefer setIndicator(Indicator) with a direct instance (e.g. avi.setIndicator(new BallPulseIndicator())) to bypass reflection entirely.
  4. If using XML, set app:indicatorName to a valid name and ensure the custom view class is com.wang.avi.AVLoadingIndicatorView.
  5. Check logcat for the full ClassNotFoundException context and disable code shrinking or add a keep rule for com.wang.avi.** if minification stripped the class.
  6. Switch to AVLoadingIndicatorView v2's enum-style approach ( avi.setIndicator(Indicator) or the updated name constants) if you upgraded from v1 naming conventions.

Example fix

// before
 avi.setIndicator("ball-pulse"); // logs 'Didn't find your class'
// after
 avi.setIndicator("BallPulseIndicator"); // or avi.setIndicator(new BallPulseIndicator());
Defensive patterns

Strategy: validation

Validate before calling

// Validate the indicator name before calling setIndicator(String)
public static boolean isValidIndicator(String name) {
    if (name == null || name.isEmpty()) return false;
    try {
        Class.forName("com.wang.avi.indicators." + name + "Indicator");
        return true;
    } catch (ClassNotFoundException e) {
        return false;
    }
}
// usage: if (isValidIndicator("BallPulse")) avi.setIndicator("BallPulse");

Type guard

// Prefer the typed API and let the compiler enforce validity
public static <T extends Indicator> T indicatorOrNull(Class<T> clazz) {
    try {
        return clazz.newInstance();
    } catch (Exception e) {
        return null;
    }
}
Indicator ind = indicatorOrNull(BallPulseIndicator.class);
if (ind != null) avi.setIndicator(ind);

Try / catch

// Since the library only logs, guard by checking before/after, or call the typed overload in try-catch
try {
    avi.setIndicator(userProvidedName); // only logs on failure
} catch (Exception e) {
    // defensive: fall back to a known-good indicator
    avi.setIndicator(new BallPulseIndicator());
}
// Always verify: if (avi.getIndicator() == null) avi.setIndicator(new BallPulseIndicator());

Prevention

When it happens

Trigger: Calling setIndicator("BallPulse") (or the XML attribute indicatorName) with a name that does not match an indicator class name exactly — e.g. wrong casing, a display-style name like "ball-pulse" when string lookup expects the class simple name, or a name from a style/enum list not present in the dependency version.

Common situations: Typo or wrong casing of the indicator name; using a kebab-case name from older docs/versions where the lookup expects the class simple name; the indicator class was removed/renamed in a newer version of the library; building the class-name string yourself and getting the package prefix wrong; ProGuard/R8 stripping indicator classes in a minified release build.


AI-assisted analysis of HarlonWang/AVLoadingIndicatorView@841f98d230 (2026-09-10). Data as JSON: /api/errors/bc3d24ac28408fcd. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/com/wang/avi/AVLoadingIndicatorView.java:177

     */
    public void setIndicator(String indicatorName){
        if (TextUtils.isEmpty(indicatorName)){
            return;
        }
        StringBuilder drawableClassName=new StringBuilder();
        if (!indicatorName.contains(".")){
            String defaultPackageName=getClass().getPackage().getName();
            drawableClassName.append(defaultPackageName)
                    .append(".indicators")
                    .append(".");
        }
        drawableClassName.append(indicatorName);
        try {
            Class<?> drawableClass = Class.forName(drawableClassName.toString());
            Indicator indicator = (Indicator) drawableClass.newInstance();
            setIndicator(indicator);
        } catch (ClassNotFoundException e) {
            Log.e(TAG,"Didn't find your class , check the name again !");
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    public void smoothToShow(){
        startAnimation(AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_in));
        setVisibility(VISIBLE);
    }

    public void smoothToHide(){
        startAnimation(AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_out));
        setVisibility(GONE);
    }

    public void hide() {

View on GitHub (pinned to 841f98d230)