我对此构建问题感到困惑。 以下案例成功构建。
案例1
`
public Insets getOpticalInsets() {
System.out.println(" hello ");
return Insets.NONE;
}
`
案例2
`
public Insets getOpticalInsets() {
{
return Insets.NONE;
}
}
`
但是以下情况失败并将错误消息显示为“返回不可用的类型插入”
案例失败
`
public Insets getOpticalInsets() {
{
System.out.println(" hello ");
return Insets.NONE;
}
}
`
我搜索了类似的错误但找不到任何有用的内容。有人可以解释一下这究竟是什么错误。
完成日志消息
frameworks / base / graphics / java / android / graphics / drawable / Drawable.java:601:错误110:方法android.graphics.drawable.Drawable.getOpticalInsets返回不可用的类型Insets
源文件:
`
package android.graphics.drawable;
import android.graphics.Insets;
import android.os.Trace;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.NinePatch;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Build;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.StateSet;
import android.util.TypedValue;
import android.util.Xml;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.Arrays;
public abstract class Drawable {
private static final Rect ZERO_BOUNDS_RECT = new Rect();
private int[] mStateSet = StateSet.WILD_CARD;
private int mLevel = 0;
private int mChangingConfigurations = 0;
private Rect mBounds = ZERO_BOUNDS_RECT;
private WeakReference<Callback> mCallback = null;
private boolean mVisible = true;
private int mLayoutDirection;
private String mImagePath;
public Insets getOpticalInsets() {
{
System.out.println(" hello ");
return Insets.NONE;
}
}
}
`