0
私はアンドロイドの開発者サイトで与えられた "Form Stuff"の例を試しています。しかし、エミュレータでは、アプリケーションが予期せず動作を停止したというメッセージが表示され続けます。私はサイトのコードを完全にコピーしましたが、これは起こっているようです。私は何を間違えているのですか?Hello Form Stuffアプリケーションの問題がエミュレータで動作しない
HelloFormStuff2.java:
package com.android.HelloLinearLayouts;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class HelloFormStuff2 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Perform action on clicks
Toast.makeText(HelloFormStuff2.this,
"Beep Bop",
Toast.LENGTH_SHORT).show();
}
});
}
}
main.xmlファイル:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@drawable/android_button" />
</LinearLayout>
がandroid_button.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/android_pressed"
android:state_pressed="true" />
<item android:drawable="@drawable/android_focused"
android:state_focused="true" />
<item android:drawable="@drawable/android_normal" />
</selector>
私は何をすべき?
ログ: これが最後に何が起こっているかである: -
08-10 09:30:15.335: DEBUG/AndroidRuntime(265): Shutting down VM
08-10 09:30:15.335: DEBUG/jdwp(265): adbd disconnected
08-10 09:30:15.405: INFO/AndroidRuntime(265): NOTE: attach of thread 'Binder Thread #3' failed
08-10 09:30:15.865: INFO/ARMAssembler(58): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x3462c8:0x3463d4] in 376387 ns
08-10 09:30:15.955: DEBUG/AndroidRuntime(277): Shutting down VM
08-10 09:30:15.955: WARN/dalvikvm(277): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): FATAL EXCEPTION: main
08-10 09:30:16.024: ERROR/AndroidRuntime(277): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.HelloLinearLayouts/com.android.HelloLinearLayouts.HelloFormStuff2Activity}: java.lang.ClassNotFoundException: com.android.HelloLinearLayouts.HelloFormStuff2Activity in loader dalvik.system.PathClassLoader[/data/app/com.android.HelloLinearLayouts-1.apk]
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): Caused by: java.lang.ClassNotFoundException: com.android.HelloLinearLayouts.HelloFormStuff2Activity in loader dalvik.system.PathClassLoader[/data/app/com.android.HelloLinearLayouts-1.apk]
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
08-10 09:30:16.024: ERROR/AndroidRuntime(277): ... 11 more
08-10 09:30:16.117: WARN/ActivityManager(58): Force finishing activity com.android.HelloLinearLayouts/.HelloFormStuff2Activity
08-10 09:30:16.355: INFO/ARMAssembler(58): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x3266a0:0x32675c] in 338074 ns
08-10 09:30:16.655: WARN/ActivityManager(58): Activity pause timeout for HistoryRecord{44f9f440 com.android.HelloLinearLayouts/.HelloFormStuff2Activity}
08-10 09:30:27.147: WARN/ActivityManager(58): Activity destroy timeout for HistoryRecord{44f9f440 com.android.HelloLinearLayouts/.HelloFormStuff2Activity}
08-10 09:35:06.196: DEBUG/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol
08-10 09:35:16.209: INFO/Process(277): Sending signal. PID: 277 SIG: 9
08-10 09:35:16.235: INFO/ActivityManager(58): Process com.android.HelloLinearLayouts (pid 277) has died.
08-10 09:35:16.385: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: [email protected]