小编Cag*_*lut的帖子

类未定义无参数构造函数。如果您使用的是ProGuard,请确保未剥离这些构造函数

我正在尝试在android studio上创建一个聊天应用程序。我的应用程序没有构建错误,我可以启动该应用程序。但是,当我使用listOfMessage.setAdapter(adapter);我的应用程序时会崩溃。它确实启动了应用程序,但是在我说1-2秒之后,它使应用程序崩溃了。在上logcat,我Class does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped error message.可以告诉我如何解决这个问题吗?

当我不使用时listOfMessage.setAdapter(adapter);,我在应用程序上写下的所有内容都不会显示在上listview,但是我看到条目可以正常使用。下面的代码:

public class MainActivity extends AppCompatActivity {



private static int SIGN_IN_REQUEST_CODE = 1;
private FirebaseListAdapter<ChatMessage> adapter;
RelativeLayout activity_main;
FloatingActionButton sendButton;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    activity_main =(RelativeLayout)findViewById(R.id.activiy_main);
    sendButton = (FloatingActionButton) findViewById(R.id.sendButton);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            EditText input = (EditText)findViewById(R.id.input);
            FirebaseDatabase.getInstance().getReference().push().setValue(new …
Run Code Online (Sandbox Code Playgroud)

android chat

5
推荐指数
5
解决办法
5008
查看次数

标签 统计

android ×1

chat ×1