如何解决java.lang.IllegalArgumentException:在Android Libgdx项目中编译着色器时出错?

如何解决java.lang.IllegalArgumentException:在Android Libgdx项目中编译着色器时出错?,android,libgdx,Android,Libgdx,我正在Libgdx中创建一个游戏,为了与android用户界面交互,我在类中创建了接口并调用了方法的超级实现,在android的主要活动中,我使用了方法实现并添加了android代码。 当我尝试运行它时,我遇到了这个错误 这是接口类及其转到android类的方法 public interface abcInterface { public void method1(); } 在Libgdx中,我调用这个方法 game.method1(int a,int b); 在主活动中,我调用这个接口方

我正在Libgdx中创建一个游戏,为了与android用户界面交互,我在类中创建了接口并调用了方法的超级实现,在android的主要活动中,我使用了方法实现并添加了android代码。 当我尝试运行它时,我遇到了这个错误

这是接口类及其转到android类的方法

public interface abcInterface {

public void method1();
}

在Libgdx中,我调用这个方法

game.method1(int a,int b);
在主活动中,我调用这个接口方法实现

public void showmethod( final int level, int score)
{
    interface.method1(a,b, new interface() {

        @Override
        public void clickplay() {

            //...............
.................//

     }
    });
}

我正在尝试调用回调方法,但我遇到了此错误,需要一些建议和解决方案。

这是您的界面

public interface abcInterface {

            public void method1();

            }
像这样为你的界面创建一个对象

abcInterface abc = new abcInterface() {

            @Override
            public void method1() {
                // do here whatever you want 

            }
        };
abc.method1();
现在可以像这样调用接口的方法

abcInterface abc = new abcInterface() {

            @Override
            public void method1() {
                // do here whatever you want 

            }
        };
abc.method1();

这是您的界面

public interface abcInterface {

            public void method1();

            }
像这样为你的界面创建一个对象

abcInterface abc = new abcInterface() {

            @Override
            public void method1() {
                // do here whatever you want 

            }
        };
abc.method1();
现在可以像这样调用接口的方法

abcInterface abc = new abcInterface() {

            @Override
            public void method1() {
                // do here whatever you want 

            }
        };
abc.method1();
使用以下代码更改showmethod(),我希望您的问题能够得到解决

public void showmethod(final int level, int score) {
    interface.method1(a, b, new interface() {

        @Override
        public void clickplay() {
            Gdx.app.postRunnable(new Runnable() {

                @Override
                public void run() {
                    //............... do your stuf here ................. //
                }
            });
        }
    });
}
使用以下代码更改showmethod(),我希望您的问题能够得到解决

public void showmethod(final int level, int score) {
    interface.method1(a, b, new interface() {

        @Override
        public void clickplay() {
            Gdx.app.postRunnable(new Runnable() {

                @Override
                public void run() {
                    //............... do your stuf here ................. //
                }
            });
        }
    });
}

请正确设置问题的格式,并修复上一个代码示例中的代码。你在那里写的是错误的。好的@Nitram,谢谢。请正确设置你的问题的格式,并修复上一个代码示例中的代码。你在那里写的是错的。好的@Nitram,谢谢你,你就是那个人。救了我。我想知道为什么这个问题首先发生在你身上。救了我。我想知道为什么这个问题首先会发生