我没有解决错误。我应该如何编辑代码。
尝试添加:
package android.graphics;
import android.graphics.AvoidXfermode;
import android.graphics.AvoidXfermode.Mode;
public ColorSwapBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int pColorKeyColorARGBPackedInt, final int pTolerance, final int pColorSwapColorARGBPackedInt, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColorKeyColorARGBPackedInt = pColorKeyColorARGBPackedInt;
this.mTolerance = pTolerance;
this.mColorSwapColorARGBPackedInt = pColorSwapColorARGBPackedInt;
this.mPaint.setXfermode(new AvoidXfermode(pColorKeyColorARGBPackedInt, pTolerance, Mode.TARGET));
this.mPaint.setColor(pColorSwapColorARGBPackedInt);
if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
Debug.w("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
}
}
@Override
public ColorSwapBitmapTextureAtlasSourceDecorator deepCopy() {
return new ColorSwapBitmapTextureAtlasSourceDecorator(this.mBitmapTextureAtlasSource, this.mBitmapTextureAtlasSourceDecoratorShape, this.mColorKeyColorARGBPackedInt, this.mTolerance, this.mColorSwapColorARGBPackedInt, this.mTextureAtlasSourceDecoratorOptions);
}
错误:
任务:andEngine:compileDebugJavaWithJavac C:\ Users \ Admin \ Desktop \ New \ Super \ andEngine \ src \ main \ java \ org \ andengine \ opengl \ texture \ atlas \ bitmap \ source \ decorator \ ColorSwapBitmapTextureAtlasSourceDecorator.java:10:错误:找不到符号 导入android.graphics.AvoidXfermode; ^ 符号:类避免Xfermode 位置:包android.graphics C:\ Users \ Admin \ Desktop \ New \ Super \ andEngine \ src \ main \ java \ org \ andengine \ opengl \ texture \ atlas \ bitmap \ source \ decorator \ ColorSwapBitmapTextureAtlasSourceDecorator.java:11:错误:打包了android.graphics。避免Xfermode不存在 导入android.graphics.AvoidXfermode.Mode; ^ C:\ Users \ Admin \ Desktop \ New \ Super \ andEngine \ src \ main \ java \ org \ andengine \ opengl \ texture \ atlas \ bitmap \ source \ decorator \ ColorSwapBitmapTextureAtlasSourceDecorator.java:79:错误:找不到符号 this.mPaint.setXfermode(new避免Xfermode(pColorKeyColorARGBPackedInt,pTolerance,Mode.TARGET)); ^ 符号:类避免Xfermode 位置:类ColorSwapBitmapTextureAtlasSourceDecorator C:\ Users \ Admin \ Desktop \ New \ Super \ andEngine \ src \ main \ java \ org \ andengine \ opengl \ texture \ atlas \ bitmap \ source \ decorator \ ColorSwapBitmapTextureAtlasSourceDecorator.java:79:错误:找不到符号 this.mPaint.setXfermode(new避免Xfermode(pColorKeyColorARGBPackedInt,pTolerance,Mode.TARGET)); ^ 符号:可变模式 位置:类ColorSwapBitmapTextureAtlasSourceDecorator C:\ Users \ Admin \ Desktop \ New \ Super Max World \ andEngine \ src \ main \ java \ org \ andengine \ opengl \ texture \ atlas \ bitmap \ source \ decorator \ ColorSwapBitmapTextureAtlasSourceDecorator.java:83:错误:找不到符号 Debug.w(“ Class” + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName()+“不推荐用于Android API级别:”“ + Build.VERSION_CODES.JELLY_BEAN +”'及更高版本,因为类“ +避免Xfermode.class.getSimpleName( )+“从那时起不推荐使用。”); ^ 符号:类避免Xfermode 位置:类ColorSwapBitmapTextureAtlasSourceDecorator 注意:某些输入文件使用或覆盖不推荐使用的API。 注意:有关详细信息,请使用-Xlint:deprecation重新编译。 注意:某些输入文件使用未经检查或不安全的操作。 注意:使用-Xlint:unchecked重新编译以获取详细信息。 5个错误
答案 0 :(得分:0)
修改您的代码,使用Log调试代码
if (SystemUtils.isAndroidVersionOrHigher(Build.VERSION_CODES.JELLY_BEAN)) {
Log.d("The class " + ColorSwapBitmapTextureAtlasSourceDecorator.class.getSimpleName() + " is deprecated for Android API Level: '" + Build.VERSION_CODES.JELLY_BEAN + "' and higher, since the class " + AvoidXfermode.class.getSimpleName() + " is deprecated since then.");
}