也许这是一个新手问题,因为我还是 java/android..sorry.. 的新手。我在 onclick(SettingActivity) 收到以下错误日志。我发现一些类似的帖子谈论了我已经从城市飞艇库导入的 jar 文件。希望有人可以帮助我度过难关。非常感谢!
Unable to resolve superclass of Lcom/app/android/SettingActivity; (2487)
Link of class 'Lcom/app/android/SettingActivity;' failed
Could not find class 'com.app.android.SettingActivity',
referenced from method com.app.android.HomeActivity.onOptionsItemSelected
VFY: unable to resolve const-class 594 (Lcom/app/android/SettingActivity;)
in Lcom/app/android/HomeActivity;
HomeActivity.java
// Initiating Menu XML
@Override
public boolean onCreateOptionsMenu(Menu bottom_menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.bottom_menu, bottom_menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.btn_logout:
userFunctions.logoutUser(getApplicationContext());
Intent login = new Intent(getApplicationContext(), LoginActivity.class);
login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(login);
finish();
return true;
case R.id.btn_setting:
Intent i = new Intent(getApplicationContext(), SettingActivity.class);
startActivity(i);
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
SettingActivity.java
package com.app.android;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.urbanairship.Logger;
import com.urbanairship.analytics.InstrumentedActivity;
import com.urbanairship.location.UALocationManager;
public class SettingActivity extends InstrumentedActivity {
Button launchButton, locationButton;
IntentFilter boundServiceFilter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setting);
更新
现在我在清理后得到这些错误..
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.app.android.SettingActivity
at com.app.android.HomeActivity.onOptionsItemSelected(HomeActivity.java:169)
at android.app.Activity.onMenuItemSelected(Activity.java:2507)
at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:982)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:468)
at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:126)
at android.view.View$PerformClick.run(View.java:14165)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
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:980)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
at dalvik.system.NativeStart.main(Native Method)