从Parse迁移到Heroku,但Parse.Configuration.Builder将无法解析

时间:2016-03-21 22:10:12

标签: android heroku parse-platform

我陷入了最后一步,试图将我的Android应用程序迁移到heroku。在我的Android应用程序中,我需要使用Parse.Configuration.Builder初始化我的解析服务器,但“配置”为红色,我无法弄清楚如何解决问题。

我在github上引用了解析服务器: https://github.com/ParsePlatform/parse-server-example

它提供了这个样板代码,用于初始化你的Android应用程序以使用heroku:

Parse.initialize(new Parse.Configuration.Builder(getApplicationContext()).applicationId("myAppId").clientKey("myClientKey").server("http://myServerUrl/parse/").build());

当我创建一个新项目时,我没有收到错误,但是我已经检查了构建文件并对旧项目进行了清单,并且无法弄清楚可能存在的问题。

这是我的应用程序类:

package oneonanyone.com.fantasybasketball_1onany1;

import com.parse.Parse;

public class StatSelectApplication extends android.app.Application {

@Override
public void onCreate() {
    super.onCreate();
    //Parse.enableLocalDatastore(this);
    //Parse.initialize(this, "xxxxx", "xxxxx");

    Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
            .applicationId("xxxxx")
            .clientKey("xxxxx")
            .server("http://xxxxx.herokuapp.com/parse/")
            .build());
    }
}

build.grade

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"


defaultConfig {
    applicationId "oneonanyone.com.fantasybasketball_1onany1"
    minSdkVersion 15

    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        debuggable true

    }
    repositories {
        jcenter()

        maven {
            url "https://s3.amazonaws.com/repo.commonsware.com"
        }
    }
}
}

dependencies {

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'


compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.parse:parse-android:1.13.0'
compile fileTree('libs')
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.commonsware.cwac:wakeful:1.0.+'

}

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      package="oneonanyone.com.fantasybasketball_1onany1">

<uses-sdk/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SET_DEBUG_APP"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
<uses-permission android:name="android.permission.VIBRATE"/>

<!--
 To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
 option is required to comply with the Google+ Sign-In developer policies
-->
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>

<!-- To retrieve the account name (email) as part of sign-in: -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>

<application
    android:name=".StatSelectApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launch"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <activity
        android:name=".DraftListActivity"
        android:label="PlayerListActivity"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"/>
    <activity
        android:name=".MainActivity"
        android:label="Darkhorse"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
        android:name=".MatchUpActivity"
        android:label="@string/title_activity_matchup"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustPan">
        >
    </activity>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"/>

    <activity
        android:name=".MatchUpResultsActivity"
        android:label="@string/title_activity_game_results"
        android:screenOrientation="portrait"/>
    <activity
        android:name=".Login.LoginActivity"
        android:label="@string/title_activity_login"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|stateHidden"/>
    <activity
        android:name=".Login.SignUpAtivity"
        android:label="@string/title_activity_sign_up_ativity"
        android:screenOrientation="portrait"/>
    <activity
        android:name=".ResultsActivityNew"
        android:label="@string/title_activity_new_results"
        android:screenOrientation="portrait"/>
    <activity
        android:name=".LeaderBoardActivity"
        android:label="@string/title_activity_leader_board"
        android:screenOrientation="portrait"/>
    <activity
        android:name=".AlternateDraftActivity"
        android:label="@string/title_activity_alternate_draft"/>

    <receiver android:name=".UpdateBackend">
        <intent-filter>
            <action android:name="android.net.ConnectivityManager.CONNECTIVITY_ACTION"/>
        </intent-filter>
    </receiver>


</application>

我的项目是为了以防万一:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-beta5'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
}

我找不到其他人有此错误。任何解决方案都将非常受欢迎。

1 个答案:

答案 0 :(得分:2)

在此处查看答案:connecting android to local parse server cannot resolve symbol Configuration

我将Parse库作为libs文件夹中的jar。通过删除它并从Gradle编译来解决问题。