W/System.err: com.parse.ParseRequest$ParseRequestException: i/o 失败

W/System.err: com.parse.ParseRequest$ParseRequestException: i/o failure

我正在尝试 运行 在 Parse 服务器中使用匿名登录的应用程序,但我在日志 cat 中得到以下信息。

应用程序 运行s 仅在我的一台设备上使用 android oreo 8.1,但在其他设备上使用 Android pie the log cat给出.

这只发生在这个应用程序上,我从那里的用户那里获取用户名和密码的其他应用程序也会出现同样的错误。

我已经在 Whosebug 上尝试了针对此问题的所有可能解决方案,但错误并没有出现。

有谁知道只允许一台设备连接的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);

  }
}

项目gradle

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'
        }
    }
}

应用gradle

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.then(ParseRequest.java:146)
2020-03-17 12:14:14.353 26020-26020/com.parse.starter.uber W/System.err:     at com.parse.ParseRequest.then(ParseRequest.java:140)
2020-03-17 12:14:14.354 26020-26020/com.parse.starter.uber W/System.err:     at bolts.Task.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

标题

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>