-2

Good day all. I want to apologize in advance as i am new to android. can someone please help me, i am currently following the LiveUpdate tutorial but no matter what i do i cant get it to work, it keeps in giving me the fatal error message.

This is my HomepageActivity.java

package com.parse.liveupdate2;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;

import com.parse.ParseObject;

public class HomepageActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_homepage);

        ParseObject gameScore = new ParseObject("GameScore");
        gameScore.put("score", 1337);
        gameScore.put("playerName", "Sean Plott");
        gameScore.put("cheatMode", false);
        gameScore.saveInBackground();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_homepage, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}
}

My activity_homepage.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/map"
        android:text="@string/hello_world"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</RelativeLayout>

My AndroidManifest.xml

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

    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".HomepageActivity"
        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>

My build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.parse.liveupdate2"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
}

My logcat

            10-22 22:06:53.652  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ Late-enabling CheckJNI
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 I/dalvikvm﹕ Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onSearchRequested
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ VFY: unable to resolve interface method 14132: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ VFY: replacing opcode 0x72 at 0x0002
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 I/dalvikvm﹕ Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onWindowStartingActionMode
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ VFY: unable to resolve interface method 14136: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
            10-22 22:06:53.876  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ VFY: replacing opcode 0x72 at 0x0002
            10-22 22:06:53.968  19945-19945/com.parse.liveupdate2 I/dalvikvm﹕ Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
            10-22 22:06:53.968  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ VFY: unable to resolve virtual method 14033: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
            10-22 22:06:53.968  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0007
            10-22 22:06:53.992  19945-19945/com.parse.liveupdate2 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
            10-22 22:06:53.992  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ VFY: unable to resolve virtual method 437: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
            10-22 22:06:53.992  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
            10-22 22:06:53.992  19945-19945/com.parse.liveupdate2 I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
            10-22 22:06:53.992  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ VFY: unable to resolve virtual method 459: Landroid/content/res/TypedArray;.getType (I)I
            10-22 22:06:53.992  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
            10-22 22:06:54.004  19945-19945/com.parse.liveupdate2 D/AndroidRuntime﹕ Shutting down VM
            10-22 22:06:54.024  19945-19945/com.parse.liveupdate2 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa62d9288)
            10-22 22:06:54.044  19945-19945/com.parse.liveupdate2 E/AndroidRuntime﹕ FATAL EXCEPTION: main
                java.lang.RuntimeException: Unable to start activity ComponentInfo{com.parse.liveupdate2/com.parse.liveupdate2.HomepageActivity}: java.lang.RuntimeException: You must call Parse.initialize(context, oauthKey, oauthSecret) before using the Parse library.
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                        at android.app.ActivityThread.access$600(ActivityThread.java:130)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                        at android.os.Handler.dispatchMessage(Handler.java:99)
                        at android.os.Looper.loop(Looper.java:137)
                        at android.app.ActivityThread.main(ActivityThread.java:4745)
                        at java.lang.reflect.Method.invokeNative(Native Method)
                        at java.lang.reflect.Method.invoke(Method.java:511)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                        at dalvik.system.NativeStart.main(Native Method)
                 Caused by: java.lang.RuntimeException: You must call Parse.initialize(context, oauthKey, oauthSecret) before using the Parse library.
                        at com.parse.ParseUser.checkApplicationContext(ParseUser.java:1104)
                        at com.parse.ParseUser.getCurrentUser(ParseUser.java:904)
                        at com.parse.ParseUser.getCurrentSessionToken(ParseUser.java:960)
                        at com.parse.ParseObject.saveAsync(ParseObject.java:1421)
                        at com.parse.ParseObject$9.then(ParseObject.java:1410)
                        at com.parse.ParseObject$9.then(ParseObject.java:1406)
                        at com.parse.TaskQueue.enqueue(TaskQueue.java:58)
                        at com.parse.ParseObject.saveAsync(ParseObject.java:1406)
                        at com.parse.ParseObject.saveInBackground(ParseObject.java:1497)
                        at com.parse.ParseObject.saveInBackground(ParseObject.java:1505)
                        at com.parse.liveupdate2.HomepageActivity.onCreate(HomepageActivity.java:21)
                        at android.app.Activity.performCreate(Activity.java:5008)
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                        at android.app.ActivityThread.access$600(ActivityThread.java:130)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                        at android.os.Handler.dispatchMessage(Handler.java:99)
                        at android.os.Looper.loop(Looper.java:137)
                        at android.app.ActivityThread.main(ActivityThread.java:4745)
                        at java.lang.reflect.Method.invokeNative(Native Method)
                        at java.lang.reflect.Method.invoke(Method.java:511)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                        at dalvik.system.NativeStart.main(Native Method)
            10-22 22:06:54.048  19945-19949/com.parse.liveupdate2 D/dalvikvm﹕ GC_CONCURRENT freed 244K, 3% free 10949K/11271K, paused 13ms+1ms, total 28ms
            10-22 22:06:54.056  19945-19945/com.parse.liveupdate2 D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 5ms
            10-22 22:11:54.140  19945-19945/? I/Process﹕ Sending signal. PID: 19945 SIG: 9

Please can someone help me, or if someone know where i can find the completed tutorial, i will really appreciate it much. And can someone please share a link to where i can download the correct libs files for parse if there is no fault with my code.

1 Answer 1

1

If you look the stacktrace of your exception you will see:

Caused by: java.lang.RuntimeException: You must call Parse.initialize(context, oauthKey, oauthSecret) before using the Parse library.

So you have to do that before. See this tutorial:

http://michaelevans.org/blog/2013/08/14/tutorial-building-an-android-to-do-list-app-using-parse/

Soruce:

Getting data from Parse.com using fragments

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.