我是Java的新手,而且我得到了#34;致命的例外:主要"当我尝试下载应用程序时。以下代码是我试图下载的。我已将文件名放在AndroidManifest中,或将默认程序设置为我的文件。然后我尝试运行该程序,以便将其下载到手机上。当我设置正在运行的设备并单击没关系时,我列出了致命错误。我需要知道它的主要内容是什么
`
private DcMotor motorRight;
private DcMotor motorLeft;
private DcMotor motorPivit;
private DcMotor motorArmExt;
public SevenTwoFourEight() {
}
@Override
public void init() {
motorRight = hardwareMap.dcMotor.get("motor_2");
motorLeft = hardwareMap.dcMotor.get("motor_1");
motorLeft.setDirection(DcMotor.Direction.REVERSE);
motorPivit = hardwareMap.dcMotor.get("motor_3");
motorArmExt = hardwareMap.dcMotor.get("motor_4");
}
@Override
public void loop() {
float left = -gamepad1.left_stick_y;
float right = -gamepad1.right_stick_y;
float pivit = -gamepad2.right_stick_y;
float armExt = -gamepad2.left_stick_y;
right = Range.clip(right, -1, 1);
left = Range.clip(left, -1, 1);
pivit = Range.clip(pivit, -1,1);
armExt = Range.clip(armExt, -1, 1);
right = (float)scaleInput(right);
left = (float)scaleInput(left);
pivit = (float)scaleInput(pivit);
armExt = (float)scaleInput(armExt);
motorRight.setPower(right);
motorLeft.setPower(left);
motorPivit.setPower(pivit);
motorArmExt.setPower(armExt);
}
@Override
public void stop() {
}
private double scaleInput(double dVal) {
double[] scaleArray = { 0.0, 0.05, 0.09, 0.10, 0.12, 0.15, 0.18, 0.24,
0.30, 0.36, 0.43, 0.50, 0.60, 0.72, 0.85, 1.00, 1.00 };
// get the corresponding index for the scaleInput array.
int index = (int) (dVal * 16.0);
// index should be positive.
if (index < 0) {
index = -index;
}
// index cannot exceed size of array minus 1.
if (index > 16) {
index = 16;
}
// get value from the array.
double dScale;
if (dVal < 0) {
dScale = -scaleArray[index];
} else {
dScale = scaleArray[index];
}
// return scaled value.
return dScale;
}
以下是我复活的完整错误消息
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: FATAL EXCEPTION: main
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: Process: com.qualcomm.ftcrobotcontroller, PID: 8439
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.qualcomm.ftcrobotcontroller/com.qualcomm.ftcrobotcontroller.K9TeleOp}: java.lang.ClassCastException: com.qualcomm.ftcrobotcontroller.K9TeleOp cannot be cast to android.app.Activity
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2113)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:138)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5095)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: Caused by: java.lang.ClassCastException: com.qualcomm.ftcrobotcontroller.K9TeleOp cannot be cast to android.app.Activity
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2104)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:138)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5095)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
11-10 15:21:34.208 8439-8439/com.qualcomm.ftcrobotcontroller E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
11-10 15:26:34.388 8439-8439/com.qualcomm.ftcrobotcontroller I/Process: Sending signal. PID: 8439 SIG: 9