Android App因未知原因崩溃

时间:2018-08-28 09:25:59

标签: android google-play

我已在Play商店中发布了一个应用,似乎多个用户都崩溃了。它没有指向导致崩溃的任何特定代码行。错误,

function createMultiThreadProgressWrapper(threads, progressCallback) {
  var threadProgress = Array(threads);

  var sendTotalProgress = function() {
    var total = 0;

    for (var v of threadProgress) {
      total = total + (v || 0);
    }

    progressCallback(total / threads);
  };

  return {
    getCallback: function(thread) {
      var cb = function(progress) {
        threadProgress[thread] = progress;
        sendTotalProgress();
      };

      return cb;
    }
  };
}

// --------------------------------------------------------
// Usage:
// --------------------------------------------------------

function createPromise(progressCallback) {
  return new Promise(function(resolve, reject) {
    // do whatever you need and report progress to progressCallback(float)
  });
}

var wrapper = createMultiThreadProgressWrapper(3, mainCallback);

var promises = [
  createPromise(wrapper.getCallback(0)),
  createPromise(wrapper.getCallback(1)),
  createPromise(wrapper.getCallback(2))
];

Promise.all(promises);

2 个答案:

答案 0 :(得分:1)

您在xml中具有onClick属性,但没有匹配功能。函数名称上可能有错字。

答案 1 :(得分:1)

您的片段的按钮可能包含onClick on XML,如下所示:

android:id="@+id/button"
android:onClick="onClick"

您的片段包含此方法

public void onClick(View view) {
// your code
}

但是,如果这不起作用,那么:

检查拼写或

在片段而不是xml中实现它:

View button = getView().findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            // you code
        }
    });