W/System.err: com.parse.ParseRequest$ParseRequestException: i/o 失败
Posted
技术标签:
【中文标题】W/System.err: com.parse.ParseRequest$ParseRequestException: i/o 失败【英文标题】:W/System.err: com.parse.ParseRequest$ParseRequestException: i/o failure 【发布时间】:2020-03-17 07:03:57 【问题描述】:我正在尝试在 Parse 服务器中运行使用匿名登录的应用程序,但我在日志 cat 中得到以下信息。
该应用程序仅在我的一台装有 android oreo 8.1 的设备上运行,但在另一台装有 Android pie 的设备上运行时,日志猫给出了。
这仅发生在此应用程序中,其他应用程序在我从用户那里获取用户名和密码时也会出现相同的错误。
我已经在***上尝试了所有可能的解决方案,但错误没有消失。
有谁知道 Parse 服务器只允许一个设备连接吗?
清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.parse.starter.uber">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".StarterApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".DriverLocationActivity"
android:label="@string/title_activity_driver_location"></activity>
<activity android:name=".ViewRequestsActivity" />
<activity
android:name=".RiderActivity"
android:label="@string/title_activity_rider" />
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
连接解析服务器的StarterApplication文件
package com.parse.starter.uber;
import android.app.Application;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.SaveCallback;
public class StarterApplication extends Application
@Override
public void onCreate()
super.onCreate();
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("MY_APP_ID")
.clientKey("MY_CLIENT_ID")
.server("http://13.126.179.137:80/parse/")
.build()
);
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
项目分级
buildscript
repositories
mavenCentral()
jcenter()
maven
url 'https://maven.google.com/'
name 'Google'
dependencies
classpath 'com.android.tools.build:gradle:3.5.3'
allprojects
repositories
mavenCentral()
maven
url 'https://maven.google.com/'
name 'Google'
应用分级
apply plugin: 'com.android.application'
android
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig
applicationId "com.parse.starter.uber"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
dexOptions
javaMaxHeapSize "4g"
buildTypes
release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.parse.bolts:bolts-tasks:1.4.0'
implementation 'com.parse:parse-android:1.17.3'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
日志猫
2020-03-17 12:14:14.349 26020-26020/com.parse.starter.uber W/System.err: com.parse.ParseRequest$ParseRequestException: i/o failure
2020-03-17 12:14:14.353 26020-26020/com.parse.starter.uber W/System.err: at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:292)
2020-03-17 12:14:14.353 26020-26020/com.parse.starter.uber W/System.err: at com.parse.ParseRequest$2.then(ParseRequest.java:146)
2020-03-17 12:14:14.353 26020-26020/com.parse.starter.uber W/System.err: at com.parse.ParseRequest$2.then(ParseRequest.java:140)
2020-03-17 12:14:14.354 26020-26020/com.parse.starter.uber W/System.err: at bolts.Task$15.run(Task.java:917)
2020-03-17 12:14:14.354 26020-26020/com.parse.starter.uber W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-03-17 12:14:14.354 26020-26020/com.parse.starter.uber W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-03-17 12:14:14.354 26020-26020/com.parse.starter.uber W/System.err: at java.lang.Thread.run(Thread.java:764)
2020-03-17 12:14:14.355 26020-26020/com.parse.starter.uber W/System.err: Caused by: java.net.UnknownServiceException: CLEARTEXT communication to 13.126.179.137 not permitted by network security policy
.
.
.
.
.
2020-03-17 12:14:14.363 26020-26020/com.parse.starter.uber I/Info: Anonymous Login Failed
【问题讨论】:
请参阅网络安全策略不允许与 13.126.179.137 进行 CLEARTEXT 通信 【参考方案1】:标题
Manifest merger failed : Attribute application@appComponentFactory - Androidx
选项 1 - 创建文件 res/xml/network_security_config.xml -
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">Your URL(ex: 127.0.0.1)</domain>
</domain-config>
</network-security-config>
AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
...
android:networkSecurityConfig="@xml/network_security_config"
...>
...
</application>
</manifest>
选项 2 - AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
...
android:usesCleartextTraffic="true"
...>
...
</application>
</manifest>
【讨论】:
以上是关于W/System.err: com.parse.ParseRequest$ParseRequestException: i/o 失败的主要内容,如果未能解决你的问题,请参考以下文章
在尝试解析 JSON 数据 W/System.err 时出现此错误:org.json.JSONException:对客户没有价值
Android SQLite:W / System.err:java.io.FileNotFoundException无法从资产复制数据库
W/System.err: java.lang.SecurityException: Permission denied (missing INTERNET permission?)
Android Studio, Firebase W/System.err: org.json.JSONException: Index 0 out of range [0..0)
Поменялась структура ответа。 W/System.err:java.lang.NullPointerException