Java 不幸的是,应用程序已停止并导致E/installd:system dir 0:/system/app/
我正在构建一个android应用程序,首先,用户使用id注册帐户,然后登录,系统将检查该用户是否使用注册时使用的相同设备。当设备相同时,系统将向服务器发送令牌。这是检查用户设备时的方法:Java 不幸的是,应用程序已停止并导致E/installd:system dir 0:/system/app/,java,android,Java,Android,我正在构建一个android应用程序,首先,用户使用id注册帐户,然后登录,系统将检查该用户是否使用注册时使用的相同设备。当设备相同时,系统将向服务器发送令牌。这是检查用户设备时的方法: private void cekDataLogin(final String serial, final String device) throws IOException, JSONException { @SuppressLint("StaticFieldLeak") class dataL
private void cekDataLogin(final String serial, final String device) throws IOException, JSONException {
@SuppressLint("StaticFieldLeak")
class dataLogin extends AsyncTask<Void, Void, String> {
private final WeakReference<MainActivity> mActivityRef;
private dataLogin(MainActivity activity) {
mActivityRef = new WeakReference<>(activity);
}
protected String doInBackground(Void[] params) {
String response = "";
HashMap<String, String> map = new HashMap<>();
try {
HttpRequest req = new HttpRequest(ipAddress + "/preserv/index.php?func=tokenget&ser=" + serial + "&dev=" + device);
response = req.prepare(HttpRequest.Method.GET).sendAndReadString();
} catch (Exception e) {
response = e.getMessage();
}
return response;
}
protected void onPostExecute(String result) {
onTaskCompletedPin(result, jsoncode);
}
}
new dataLogin(this).execute();
}
public void onTaskCompletedPin(String response, int serviceCode) {
Log.d("responsejson", response);
switch (serviceCode) {
case jsoncode:
try {
postDataToken();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
有什么想法吗?我是android新手,有时应用程序运行正常(在多次类似错误之后),但当我清除数据/卸载时,主要导致此E/installd:system dir 0:/system/app/和有时E/FirebaseInstanceId:Token检索失败:服务不可用,因为我在生成新令牌时使用firebase。我已经设置了仅当设备连接到internet时生成令牌
static jint android_util_Log_println_native(JNIEnv* env, jobject clazz,
jint bufID, jint priority, jstring tagObj, jstring msgObj)
{
const char* tag = NULL;
const char* msg = NULL;
if (msgObj == NULL) {
jniThrowNullPointerException(env, "println needs a message");
return -1;
}
// Rest of the method
}
根据Android中打印消息的本机打印方法,您的消息对象应为非空值
在您的情况下,响应对象为null。所以在打印消息之前添加空检查
if(null != response)
{
Log.d("responsejson", response);
}
如果您仍要打印响应对象的值,即使它为空。尽量使用下面的行
Log.d("responsejson", "Response is "+response);
这一行可能重复'Log.d(“responsejson”,response);`这是个问题。服务器响应中的响应是字符串“sukses”(success)。它不是空的,您的错误日志清楚地表明您的响应是空的,这就是发生崩溃的原因。as
Log.d
需要非空消息08-06 14:37:41.118 17833-17833/?答:苏克斯。但这是我的日志responsejson@pdiani,是否尝试在打印响应对象的位置添加空检查。响应的日志是08-06 14:58:02.148 24770-24770/?回答:回答是sukses。但应用程序仍然停止了。我已尝试不记录响应对象,但不起作用。@pdiani,请再次检查堆栈跟踪,并指出应用程序崩溃的确切位置。编辑日志,重复显示D/PackageManager:remove MCS_UNBIND message(删除MCS_解除绑定消息)并在10秒后发布MCS_UNBIND(解除绑定)时出错E/installd:system dir 0:/system/app/over and over,除非req.prepare
可以返回null,否则这不是问题所在
if(null != response)
{
Log.d("responsejson", response);
}
Log.d("responsejson", "Response is "+response);