1

だから私はMySQL、PHPログインを持つアプリを持っています..昨日はうまくいきましたが、今夜はログインしようとするたびにこのエラーが発生しています:

これが私のLogCatです:

    12-02 23:20:57.259: D/dalvikvm(10592): GC_CONCURRENT freed 65K, 52% free 2617K/5379K, external 1565K/2077K, paused 7ms+2ms
12-02 23:21:03.709: E/JSON(10592): {"tag":"login","success":1,"error":0,"uid":"50bc1f349f8b78.26242231","user":{"name":"jon","email":"jon","created_at":"2012-12-02 22:40:36","updated_at":null}}n
12-02 23:21:03.809: D/AndroidRuntime(10592): Shutting down VM
12-02 23:21:03.809: W/dalvikvm(10592): threadid=1: thread exiting with uncaught exception (group=0x2aac8560)
12-02 23:21:03.839: E/AndroidRuntime(10592): FATAL EXCEPTION: main
12-02 23:21:03.839: E/AndroidRuntime(10592): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.groupone.the.health.effect/com.groupone.the.health.effect.DashboardActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class com.groupone.the.health.effect.dashboard
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.ActivityThread.access$1500(ActivityThread.java:121)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.os.Looper.loop(Looper.java:123)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.ActivityThread.main(ActivityThread.java:3701)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at java.lang.reflect.Method.invokeNative(Native Method)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at java.lang.reflect.Method.invoke(Method.java:507)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at dalvik.system.NativeStart.main(Native Method)
12-02 23:21:03.839: E/AndroidRuntime(10592): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.groupone.the.health.effect.dashboard
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.Activity.setContentView(Activity.java:1657)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at com.groupone.the.health.effect.DashboardActivity.onCreate(DashboardActivity.java:27)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
12-02 23:21:03.839: E/AndroidRuntime(10592):    ... 11 more
12-02 23:21:03.839: E/AndroidRuntime(10592): Caused by: java.lang.ClassNotFoundException: com.groupone.the.health.effect.dashboard in loader dalvik.system.PathClassLoader[/data/app/com.groupone.the.health.effect-2.apk]
12-02 23:21:03.839: E/AndroidRuntime(10592):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.view.LayoutInflater.createView(LayoutInflater.java:471)
12-02 23:21:03.839: E/AndroidRuntime(10592):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
12-02 23:21:03.839: E/AndroidRuntime(10592):    ... 19 more
12-02 23:21:03.899: D/dalvikvm(10592): GC_CONCURRENT freed 224K, 50% free 2870K/5703K, external 1565K/2077K, paused 2ms+14ms

ここに私のXMLがあります:

<?xml version="1.0" encoding="utf-8"?>
<com.groupone.the.health.effect.dashboard
     xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#3b3b3b">

    <TextView android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="WELCOME"
              android:textSize="40dip"
              android:gravity="center"
              android:layout_marginTop="20dip"/>

    <Button android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Log Me Out"
        android:textSize="20dip"
        android:textColor="#21dbd4"
        android:textStyle="bold"
        android:id="@+id/btnLogout"
        android:layout_marginTop="80dip"
        android:background="@null"/>

    <Button
        android:id="@+id/btn_news_feed"
        style="@style/DashboardButton"
        android:drawableTop="@drawable/healthbook"
        android:text="Activities" />

    <Button
        android:id="@+id/btn_messages"
        style="@style/DashboardButton"
        android:drawableTop="@drawable/mental"
        android:text="Mental Input" />

    <!--  Events Button -->
    <Button
        android:id="@+id/btn_events"
        style="@style/DashboardButton"
        android:drawableTop="@drawable/graph"
        android:text="Results" />

    <!--  Photos Button -->
    <Button
        android:id="@+id/btn_photos"
        style="@style/DashboardButton"
        android:drawableTop="@drawable/doctor"
        android:text="Map" />

    <!--  Friends Button -->
    <Button
        android:id="@+id/btn_friends"
        style="@style/DashboardButton"
        android:drawableTop="@drawable/btn_facebook"
        android:text="Facebook" />

    <!--  Messages Button -->


    <!--  Places Button -->
    <Button
        android:id="@+id/btn_places"
        style="@style/DashboardButton"
        android:drawableTop="@drawable/twitter_logo"
        android:text="Health Tweets" />




</com.groupone.the.health.effect.dashboard>

そして、ここに私の .LoginActivity があります:

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.groupone.the.health.effect.library.DatabaseHandler;
import com.groupone.the.health.effect.library.UserFunctions;

public class LoginActivity extends Activity {
    Button btnLogin;
    Button btnLinkToRegister;
    EditText inputEmail;
    EditText inputPassword;
    TextView loginErrorMsg;

    // JSON Response node names
    private static String KEY_SUCCESS = "success";
    private static String KEY_ERROR = "error";
    private static String KEY_ERROR_MSG = "error_msg";
    private static String KEY_UID = "uid";
    private static String KEY_NAME = "name";
    private static String KEY_EMAIL = "email";
    private static String KEY_CREATED_AT = "created_at";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);

        // Importing all assets like buttons, text fields
        inputEmail = (EditText) findViewById(R.id.loginEmail);
        inputPassword = (EditText) findViewById(R.id.loginPassword);
        btnLogin = (Button) findViewById(R.id.btnLogin);
        btnLinkToRegister = (Button) findViewById(R.id.btnLinkToRegisterScreen);
        loginErrorMsg = (TextView) findViewById(R.id.login_error);

        // Login button Click Event
        btnLogin.setOnClickListener(new View.OnClickListener() {

            public void onClick(View view) {
                String email = inputEmail.getText().toString();
                String password = inputPassword.getText().toString();
                UserFunctions userFunction = new UserFunctions();
                JSONObject json = userFunction.loginUser(email, password);

                // check for login response
                try {
                    if (json.getString(KEY_SUCCESS) != null) {
                        loginErrorMsg.setText("");
                        String res = json.getString(KEY_SUCCESS);
                        if(Integer.parseInt(res) == 1){
                            // user successfully logged in
                            // Store user details in SQLite Database
                            DatabaseHandler db = new DatabaseHandler(getApplicationContext());
                            JSONObject json_user = json.getJSONObject("user");

                            // Clear all previous data in database
                            userFunction.logoutUser(getApplicationContext());
                            db.addUser(json_user.getString(KEY_NAME), json_user.getString(KEY_EMAIL), json.getString(KEY_UID), json_user.getString(KEY_CREATED_AT));                        

                            // Launch Dashboard Screen
                            Intent dashboard = new Intent(getApplicationContext(), DashboardActivity.class);

                            // Close all views before launching Dashboard
                            dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                            startActivity(dashboard);

                            // Close Login Screen
                            finish();
                        }else{
                            // Error in login
                            loginErrorMsg.setText("Incorrect username/password");
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });

        // Link to Register Screen
        btnLinkToRegister.setOnClickListener(new View.OnClickListener() {

            public void onClick(View view) {
                Intent i = new Intent(getApplicationContext(),
                        RegisterActivity.class);
                startActivity(i);
                finish();
            }
        });
    }
}

ありがとう!

4

2 に答える 2

1

ダッシュボードは小文字なので、パッケージのように見えます。カスタムレイアウトクラスを作成する場合は、xmlタグの親パッケージではなく、そのクラスを参照する必要があります。

于 2012-12-03T04:52:56.663 に答える
1

これはおそらく2つのことを意味します:

1)クラスはバイナリに含まれていませんでした

2)そのクラスに適切なパッケージを参照していないこと。

于 2012-12-03T04:33:17.657 に答える