Skip to content

Local Parse Server works with dashboard , but not with android studio #5045

Closed
@Mastercho321

Description

@Mastercho321

I am trying to use Parse on windows with Android Studio.

I have followed tutorials on interned and created local parse server which is appering in parse dashboard, and passed this test http://localhost:1337/test , but when i run my project in android studio I get : com.parse.ParseRequest$ParseRequestException: i/o failure.

Here is my source code :

package com.example.mitaka.parsetest2;

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();

// Enable Local Datastore.
Parse.enableLocalDatastore(this);

// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
        .applicationId("ID")
        .clientKey("KEY")
        .server("http://10.0.2.2:1337/parse/")
        .build()
);

ParseObject object = new ParseObject("ExampleObject");
object.put("myNumber", "123");
object.put("myString", "rob");

object.saveInBackground(new SaveCallback () {
    @Override
    public void done(ParseException ex) {
        if (ex == null) {
            Log.i("Parse Result", "Successful!");
        } else {
            Log.i("Parse Result", "Failed" + ex.toString());
        }
    }
});


ParseUser.enableAutomaticUser();

ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);

}
}

MainActivity:

public class MainActivity extends AppCompatActivity {

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

ParseAnalytics.trackAppOpenedInBackground(getIntent());

}
I have added:

allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
to buildGradle(Project)

and

implementation 'com.github.parse-community.Parse-SDK-Android:fcm:1.18.4'

to buildGradle(Module:app)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions