gpt4 book ai didi

java - 无法解析父类(super class)

转载 作者:行者123 更新时间:2023-11-29 21:57:12 25 4
gpt4 key购买 nike

也许这是一个新手问题,因为我还是 java/android 的新手..抱歉..我在 onclick(SettingActivity) 的错误日志之后得到了这个。我发现一些类似的帖子谈论我已经从 Urban Airship 库导入的 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);
}
}

设置 Activity .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)

enter image description here

最佳答案

尝试在您的项目目录中创建一个文件夹 libs(与可绘制对象、 Assets 等平行)并将所有外部 jar 放在那里..

然后右击你的项目 -> 配置构建路径 -> 添加外部 jar(从 libs 文件夹添加它们),

并清理你的项目..应该可以正常工作..

关于java - 无法解析父类(super class),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12947358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com